forked from hello-robot/stretch_web_interface
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpage.cmp.ts
More file actions
28 lines (24 loc) · 787 Bytes
/
page.cmp.ts
File metadata and controls
28 lines (24 loc) · 787 Bytes
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
import {BaseComponent} from './base.cmp';
export class PageComponent extends BaseComponent {
title = 'Stretch Teleop';
currentTransition = Promise.resolve();
enter() {
this.currentTransition = this.currentTransition.then(() => {
return new Promise((res, rej) => {
setTimeout(res, 500);
});
});
return this.currentTransition;
}
exit() {
return new Promise<void>((res) => {
const listener = () => {
res();
this.removeEventListener('animationend', listener);
};
this.addEventListener('animationend', listener);
this.classList.add('exit');
});
}
}
customElements.define('page-component', PageComponent);