MCPcopy Index your code
hub / github.com/angular/angular / init

Function init

modules/benchmarks/src/tree/ng2/init.ts:16–55  ·  view source on GitHub ↗
(moduleRef: NgModuleRef<AppModule>)

Source from the content-addressed store, hash-verified

14import {AppModule, TreeComponent} from './tree';
15
16export function init(moduleRef: NgModuleRef<AppModule>) {
17 let tree: TreeComponent;
18 let appRef: ApplicationRef;
19 let detectChangesRuns = 0;
20
21 function destroyDom() {
22 tree.data = emptyTree;
23 appRef.tick();
24 }
25
26 function createDom() {
27 tree.data = buildTree();
28 appRef.tick();
29 }
30
31 function detectChanges() {
32 for (let i = 0; i < 10; i++) {
33 appRef.tick();
34 }
35 detectChangesRuns += 10;
36 numberOfChecksEl.textContent = `${detectChangesRuns}`;
37 }
38
39 function noop() {}
40
41 const injector = moduleRef.injector;
42 appRef = injector.get(ApplicationRef);
43 const numberOfChecksEl = document.getElementById('numberOfChecks')!;
44
45 tree = appRef.components[0].instance;
46
47 initTreeUtils();
48
49 bindAction('#destroyDom', destroyDom);
50 bindAction('#createDom', createDom);
51 bindAction('#detectChanges', detectChanges);
52 bindAction('#detectChangesProfile', profile(detectChanges, noop, 'detectChanges'));
53 bindAction('#updateDomProfile', profile(createDom, noop, 'update'));
54 bindAction('#createDomProfile', profile(createDom, destroyDom, 'create'));
55}

Callers

nothing calls this directly

Calls 4

initTreeUtilsFunction · 0.90
bindActionFunction · 0.90
profileFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…