refactor(core): Move LifeCycle functionality into ApplicationRef.
BREAKING CHANGE: Before: constructor(@Inject(LifeCycle) lifecycle) { lifecycle.tick(); } After: constructor(@Inject(ApplicationRef) appRef) { appRef.tick(); } Closes #5008
This commit is contained in:
@ -8,7 +8,7 @@ import {
|
||||
NgIf,
|
||||
NgFor
|
||||
} from 'angular2/core';
|
||||
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {getIntParameter, bindAction} from 'angular2/src/testing/benchmark_util';
|
||||
|
||||
@ -22,29 +22,29 @@ export function main() {
|
||||
.then((ref) => {
|
||||
var injector = ref.injector;
|
||||
var app: AppComponent = ref.hostComponent;
|
||||
var lifeCycle = injector.get(LifeCycle);
|
||||
var appRef = injector.get(ApplicationRef);
|
||||
|
||||
bindAction('#reset', function() {
|
||||
app.reset();
|
||||
lifeCycle.tick();
|
||||
appRef.tick();
|
||||
});
|
||||
|
||||
// Baseline (plain components)
|
||||
bindAction('#createPlainComponents', function() {
|
||||
app.createPlainComponents();
|
||||
lifeCycle.tick();
|
||||
appRef.tick();
|
||||
});
|
||||
|
||||
// Components with decorators
|
||||
bindAction('#createComponentsWithDirectives', function() {
|
||||
app.createComponentsWithDirectives();
|
||||
lifeCycle.tick();
|
||||
appRef.tick();
|
||||
});
|
||||
|
||||
// Components with decorators
|
||||
bindAction('#createDynamicComponents', function() {
|
||||
app.createDynamicComponents();
|
||||
lifeCycle.tick();
|
||||
appRef.tick();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ import {
|
||||
NgFor,
|
||||
NgSwitch,
|
||||
NgSwitchWhen,
|
||||
NgSwitchDefault,
|
||||
LifeCycle
|
||||
NgSwitchDefault
|
||||
} from 'angular2/core';
|
||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||
import {BrowserDomAdapter} from 'angular2/src/core/dom/browser_adapter';
|
||||
import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/linker/view_pool';
|
||||
|
||||
@ -65,7 +65,7 @@ export function main() {
|
||||
BASELINE_LARGETABLE_TEMPLATE = DOM.createTemplate('<table></table>');
|
||||
|
||||
var app;
|
||||
var lifecycle;
|
||||
var appRef;
|
||||
var baselineRootLargetableComponent;
|
||||
|
||||
function ng2DestroyDom() {
|
||||
@ -73,7 +73,7 @@ export function main() {
|
||||
// --> this should be already caught in change detection!
|
||||
app.data = null;
|
||||
app.benchmarkType = 'none';
|
||||
lifecycle.tick();
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function profile(create, destroy, name) {
|
||||
@ -116,7 +116,7 @@ export function main() {
|
||||
}
|
||||
app.data = data;
|
||||
app.benchmarkType = getStringParameter('benchmarkType');
|
||||
lifecycle.tick();
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
@ -126,7 +126,7 @@ export function main() {
|
||||
.then((ref) => {
|
||||
var injector = ref.injector;
|
||||
app = ref.hostComponent;
|
||||
lifecycle = injector.get(LifeCycle);
|
||||
appRef = injector.get(ApplicationRef);
|
||||
bindAction('#ng2DestroyDom', ng2DestroyDom);
|
||||
bindAction('#ng2CreateDom', ng2CreateDom);
|
||||
bindAction('#ng2UpdateDomProfile', profile(ng2CreateDom, noop, 'ng2-update'));
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
NgIf
|
||||
} from 'angular2/core';
|
||||
import {ComponentRef_} from 'angular2/src/core/linker/dynamic_component_loader';
|
||||
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||
import {reflector} from 'angular2/src/core/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities';
|
||||
import {DOM} from 'angular2/src/core/dom/dom_adapter';
|
||||
@ -43,7 +43,7 @@ export function main() {
|
||||
setupReflector();
|
||||
|
||||
var app;
|
||||
var lifeCycle;
|
||||
var appRef;
|
||||
var baselineRootTreeComponent;
|
||||
var count = 0;
|
||||
|
||||
@ -86,19 +86,19 @@ export function main() {
|
||||
|
||||
function ng2DestroyDom() {
|
||||
app.initData = null;
|
||||
lifeCycle.tick();
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function ng2CreateDom() {
|
||||
app.initData = createData();
|
||||
lifeCycle.tick();
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function initNg2() {
|
||||
bootstrap(AppComponentWithStaticTree, createBindings())
|
||||
.then((ref) => {
|
||||
var injector = (<ComponentRef_>ref).injector;
|
||||
lifeCycle = injector.get(LifeCycle);
|
||||
appRef = injector.get(ApplicationRef);
|
||||
|
||||
app = (<ComponentRef_>ref).hostComponent;
|
||||
bindAction('#ng2DestroyDom', ng2DestroyDom);
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
NgIf
|
||||
} from 'angular2/core';
|
||||
|
||||
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
||||
import {ApplicationRef} from 'angular2/src/core/application_ref';
|
||||
import {DOM} from 'angular2/src/core/dom/dom_adapter';
|
||||
import {isPresent} from 'angular2/src/core/facade/lang';
|
||||
import {window, document, gc} from 'angular2/src/core/facade/browser';
|
||||
@ -42,7 +42,7 @@ export function main() {
|
||||
BASELINE_IF_TEMPLATE = DOM.createTemplate('<span template="if"><tree></tree></span>');
|
||||
|
||||
var app;
|
||||
var lifeCycle;
|
||||
var appRef;
|
||||
var baselineRootTreeComponent;
|
||||
var count = 0;
|
||||
|
||||
@ -50,7 +50,7 @@ export function main() {
|
||||
// TODO: We need an initial value as otherwise the getter for data.value will fail
|
||||
// --> this should be already caught in change detection!
|
||||
app.initData = new TreeNode('', null, null);
|
||||
lifeCycle.tick();
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function profile(create, destroy, name) {
|
||||
@ -86,7 +86,7 @@ export function main() {
|
||||
var values = count++ % 2 == 0 ? ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*'] :
|
||||
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', '-'];
|
||||
app.initData = buildTree(maxDepth, values, 0);
|
||||
lifeCycle.tick();
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
@ -95,7 +95,7 @@ export function main() {
|
||||
bootstrap(AppComponent, createProviders())
|
||||
.then((ref) => {
|
||||
var injector = ref.injector;
|
||||
lifeCycle = injector.get(LifeCycle);
|
||||
appRef = injector.get(ApplicationRef);
|
||||
|
||||
app = ref.hostComponent;
|
||||
bindAction('#ng2DestroyDom', ng2DestroyDom);
|
||||
|
Reference in New Issue
Block a user