generated from shgysk8zer0/npm-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.js
More file actions
19 lines (16 loc) · 643 Bytes
/
text.js
File metadata and controls
19 lines (16 loc) · 643 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { escapeHTML } from '@aegisjsproject/escape/html.js';
import { DisposableComputed, DisposableState } from './disposable.js';
import { ZERO_WIDTH_SPACE } from './consts.js';
export class TextState extends DisposableState {
toString() {
return `<!--${this.ref}-->${escapeHTML(this.get() || ZERO_WIDTH_SPACE)}<!--/${this.ref}-->`;
}
}
export class TextComputed extends DisposableComputed {
toString() {
return `<!--${this.ref}-->${escapeHTML(this.get() || ZERO_WIDTH_SPACE)}<!--/${this.ref}-->`;
}
}
export const $text = (val, config) => typeof val === 'function'
? new TextComputed(val, config)
: new TextState(val, config);