-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
35 lines (27 loc) · 922 Bytes
/
main.js
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
import {BaseComponent, Application} from './new-angular/index.js';
import {setTimeoutPatch} from './new-zonejs/patch-settimeout.js';
import {queueMicrotaskPatch} from "./new-zonejs/patch-queue-microtask.js";
import {addEventListenerPatch} from "./new-zonejs/patch-event-listener.js";
setTimeoutPatch();
queueMicrotaskPatch();
addEventListenerPatch();
class MyComponent extends BaseComponent {
constructor() {
super("MyComponent");
}
count = 0;
updateCount = () => {
this.count++;
}
templateStr = `<button (click)="{{updateCount}}">The count is: {{count}}!</button>`;
}
const app = new Application();
const component = app.createComponent(new MyComponent());
app.run(component);
// Change the state of the component and trigger-CD:
// component.count += 1;
// app.tick();
/* ---- OR ---- */
setTimeout(() => {
component.count += 1;
});