refactor(benchmarks): add index_aot to support AoT bootstrap. (#12105)

Note: This only make sure it can compile the AoT version, but does not yet use it in e2e tests.
This commit is contained in:
Tobias Bosch
2016-10-06 08:37:37 -07:00
committed by GitHub
parent ef621a2f00
commit f1cfddf6d6
11 changed files with 93 additions and 36 deletions

View File

@ -0,0 +1,32 @@
import {ApplicationRef, NgModuleRef} from '@angular/core';
import {bindAction, profile} from '../../util';
import {buildTree, emptyTree} from '../util';
import {AppModule, TreeComponent} from './tree';
export function init(moduleRef: NgModuleRef<AppModule>) {
var tree: TreeComponent;
var appRef: ApplicationRef;
function destroyDom() {
tree.data = emptyTree;
appRef.tick();
}
function createDom() {
tree.data = buildTree();
appRef.tick();
}
function noop() {}
const injector = moduleRef.injector;
appRef = injector.get(ApplicationRef);
tree = appRef.components[0].instance;
bindAction('#destroyDom', destroyDom);
bindAction('#createDom', createDom);
bindAction('#updateDomProfile', profile(createDom, noop, 'update'));
bindAction('#createDomProfile', profile(createDom, destroyDom, 'create'));
}