Skip to content

Commit

Permalink
fix(fract): completion of implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadhonarvar committed Jun 22, 2023
1 parent c8560e3 commit 355c9c7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
6 changes: 5 additions & 1 deletion core/fract/src/directive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {createLogger, globalAlwatr} from '@alwatr/logger';

import {Directive, PartType, type PartInfo} from './lit.js';
import {Directive, PartType, type PartInfo, type Part} from './lit.js';

globalAlwatr.registeredList.push({
name: '@alwatr/fract',
Expand All @@ -19,4 +19,8 @@ export class AlwatrDirective extends Directive {
this._logger.logMethodArgs?.('update', props);
return this.render(...props);
}

render(...props: unknown[]): unknown {
return this._logger.logMethodArgs?.('render', props);
}
}
21 changes: 20 additions & 1 deletion core/fract/src/dynamic-directive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {createLogger} from '@alwatr/logger';

import {PartType, type PartInfo, AsyncDirective} from './lit.js';
import {PartType, type PartInfo, AsyncDirective, Part} from './lit.js';

export class AlwatrDynamicDirective extends AsyncDirective {
protected _logger = createLogger(this.constructor.name);
Expand All @@ -10,8 +10,27 @@ export class AlwatrDynamicDirective extends AsyncDirective {
this._logger.logMethodArgs?.('constructor', Object.keys(PartType)[_partInfo.type - 1]);
}

override setValue(value: unknown): void {
super.setValue(value);
this._logger.logMethodArgs?.('setValue', value);
}

override update(_part: Part, props: Array<unknown>): unknown {
this._logger.logMethodArgs?.('update', props);
return this.render(...props);
}

render(...props: unknown[]): unknown {
return this._logger.logMethodArgs?.('render', props);
}

protected override reconnected(): void {
super.reconnected();
this._logger.logMethod?.('reconnected');
}

protected override disconnected(): void {
super.disconnected();
this._logger.logMethod?.('disconnected');
}
}

0 comments on commit 355c9c7

Please sign in to comment.