Skip to content

Commit b3bd83f

Browse files
committed
refactor(lit-helper/directives): async-directive
1 parent 6a4754d commit b3bd83f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/lit-helper/src/directives/async-directive.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ import {GecutLogger} from '@gecut/logger';
22
import {AsyncDirective, PartType} from 'lit-html/async-directive.js';
33

44
import type {Part, PartInfo} from 'lit-html/directive.js';
5+
import type {ClassInfo} from 'lit-html/directives/class-map.js';
56

67
export abstract class GecutAsyncDirective extends AsyncDirective {
7-
constructor(partInfo: PartInfo, debugName: string) {
8+
constructor(partInfo: PartInfo, name: string) {
89
super(partInfo);
9-
this.log = new GecutLogger(`<${debugName}>`);
10+
this.name = name;
11+
this.log = new GecutLogger(`<${this.name}>`);
1012

1113
this.log.methodArgs?.('constructor', Object.keys(PartType)[partInfo.type - 1]);
1214
}
1315

16+
protected name;
1417
protected log;
1518

1619
override setValue(value: unknown): void {
@@ -32,4 +35,10 @@ export abstract class GecutAsyncDirective extends AsyncDirective {
3235
this.log.method?.('disconnected');
3336
super.disconnected();
3437
}
38+
39+
protected getRenderClasses(): ClassInfo {
40+
return {
41+
[this.name]: true,
42+
};
43+
}
3544
}

0 commit comments

Comments
 (0)