-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathchild.js
More file actions
23 lines (22 loc) · 832 Bytes
/
child.js
File metadata and controls
23 lines (22 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { LightningElement, api } from 'lwc';
export default class extends LightningElement {
@api uid;
@api children = [{ uid: '1' }];
connectedCallback() {
window.timingBuffer.push(`child${this.uid}:connectedCallback`);
}
renderedCallback() {
window.timingBuffer.push(`child${this.uid}:renderedCallback`);
}
disconnectedCallback() {
// This component could get disconnected by our Karma `test-setup.js` after `window.timingBuffer` has
// already been cleared; we don't care about the `disconnectedCallback`s in that case.
if (window.timingBuffer) {
window.timingBuffer.push(`child${this.uid}:disconnectedCallback`);
}
}
@api
addChild() {
this.children = [...this.children, { uid: `${this.children.length + 1}` }];
}
}