-
Notifications
You must be signed in to change notification settings - Fork 18
/
test-promise.ts
59 lines (52 loc) · 1.23 KB
/
test-promise.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
* A test element to verify bindings
*/
import {
BasicElement,
html,
css,
CSSResult,
TemplateResult
} from '@refinitiv-ui/core';
import { customElement } from '@refinitiv-ui/core/decorators/custom-element.js';
import {
translate,
TranslatePromise
} from '../translate.js';
import './test-nested-translate.js';
import './phrasebook.js';
@customElement('test-promise', { theme: false })
export class TestPromise extends BasicElement {
/**
* A `CSSResult` that will be used
* to style the host, slotted children
* and the internal template of the element.
* @return CSS template
*/
static get styles (): CSSResult | CSSResult[] {
return css`
:host {
display: block;
padding: 0 10px 10px 10px;
}
`;
}
@translate({
scope: 'test-translate',
mode: 'promise'
})
public t!: TranslatePromise;
public promiseResult = '';
protected async performUpdate (): Promise<void> {
this.promiseResult = await this.t('DEFAULT');
void super.performUpdate();
}
/**
* A `TemplateResult` that will be used
* to render the updated internal template.
* @return Render template
*/
protected render (): TemplateResult {
return html`${this.promiseResult}`;
}
}