@angular/core
Advanced tools
Comparing version 2.2.1 to 2.3.0-beta.0
/** | ||
* @license Angular v2.2.1 | ||
* @license Angular v2.3.0-beta.0 | ||
* (c) 2010-2016 Google, Inc. https://angular.io/ | ||
@@ -4,0 +4,0 @@ * License: MIT |
{ | ||
"name": "@angular/core", | ||
"version": "2.2.1", | ||
"version": "2.3.0-beta.0", | ||
"description": "Angular - the core framework", | ||
@@ -5,0 +5,0 @@ "main": "bundles/core.umd.js", |
@@ -10,3 +10,2 @@ /** | ||
import { ApplicationInitStatus } from './application_init'; | ||
import { ChangeDetectorRef } from './change_detection/change_detector_ref'; | ||
import { Console } from './console'; | ||
@@ -18,2 +17,3 @@ import { Injector, Provider } from './di'; | ||
import { NgModuleFactory, NgModuleRef } from './linker/ng_module_factory'; | ||
import { ViewRef } from './linker/view_ref'; | ||
import { Testability, TestabilityRegistry } from './testability/testability'; | ||
@@ -43,2 +43,12 @@ import { Type } from './type'; | ||
/** | ||
* A token for third-party components that can register themselves with NgProbe. | ||
* | ||
* @experimental | ||
*/ | ||
export declare class NgProbeToken { | ||
name: string; | ||
token: any; | ||
constructor(name: string, token: any); | ||
} | ||
/** | ||
* Creates a platform. | ||
@@ -198,2 +208,16 @@ * Platforms have to be eagerly created via this function. | ||
components: ComponentRef<any>[]; | ||
/** | ||
* Attaches a view so that it will be dirty checked. | ||
* The view will be automatically detached when it is destroyed. | ||
* This will throw if the view is already attached to a ViewContainer. | ||
*/ | ||
attachView(view: ViewRef): void; | ||
/** | ||
* Detaches a view from dirty checking again. | ||
*/ | ||
detachView(view: ViewRef): void; | ||
/** | ||
* Returns the number of attached views. | ||
*/ | ||
viewCount: any; | ||
} | ||
@@ -212,13 +236,16 @@ export declare class ApplicationRef_ extends ApplicationRef { | ||
private _rootComponentTypes; | ||
private _changeDetectorRefs; | ||
private _views; | ||
private _runningTick; | ||
private _enforceNoNewChanges; | ||
constructor(_zone: NgZone, _console: Console, _injector: Injector, _exceptionHandler: ErrorHandler, _componentFactoryResolver: ComponentFactoryResolver, _initStatus: ApplicationInitStatus, _testabilityRegistry: TestabilityRegistry, _testability: Testability); | ||
registerChangeDetector(changeDetector: ChangeDetectorRef): void; | ||
unregisterChangeDetector(changeDetector: ChangeDetectorRef): void; | ||
attachView(viewRef: ViewRef): void; | ||
detachView(viewRef: ViewRef): void; | ||
bootstrap<C>(componentOrFactory: ComponentFactory<C> | Type<C>): ComponentRef<C>; | ||
private _loadComponent(componentRef); | ||
private _unloadComponent(componentRef); | ||
tick(): void; | ||
ngOnDestroy(): void; | ||
viewCount: number; | ||
componentTypes: Type<any>[]; | ||
components: ComponentRef<any>[]; | ||
} |
@@ -60,2 +60,14 @@ /** | ||
/** | ||
* A token for third-party components that can register themselves with NgProbe. | ||
* | ||
* @experimental | ||
*/ | ||
export var NgProbeToken = (function () { | ||
function NgProbeToken(name, token) { | ||
this.name = name; | ||
this.token = token; | ||
} | ||
return NgProbeToken; | ||
}()); | ||
/** | ||
* Creates a platform. | ||
@@ -357,2 +369,20 @@ * Platforms have to be eagerly created via this function. | ||
; | ||
/** | ||
* Attaches a view so that it will be dirty checked. | ||
* The view will be automatically detached when it is destroyed. | ||
* This will throw if the view is already attached to a ViewContainer. | ||
*/ | ||
ApplicationRef.prototype.attachView = function (view) { unimplemented(); }; | ||
/** | ||
* Detaches a view from dirty checking again. | ||
*/ | ||
ApplicationRef.prototype.detachView = function (view) { unimplemented(); }; | ||
Object.defineProperty(ApplicationRef.prototype, "viewCount", { | ||
/** | ||
* Returns the number of attached views. | ||
*/ | ||
get: function () { return unimplemented(); }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
return ApplicationRef; | ||
@@ -376,3 +406,3 @@ }()); | ||
this._rootComponentTypes = []; | ||
this._changeDetectorRefs = []; | ||
this._views = []; | ||
this._runningTick = false; | ||
@@ -383,7 +413,11 @@ this._enforceNoNewChanges = false; | ||
} | ||
ApplicationRef_.prototype.registerChangeDetector = function (changeDetector) { | ||
this._changeDetectorRefs.push(changeDetector); | ||
ApplicationRef_.prototype.attachView = function (viewRef) { | ||
var view = viewRef.internalView; | ||
this._views.push(view); | ||
view.attachToAppRef(this); | ||
}; | ||
ApplicationRef_.prototype.unregisterChangeDetector = function (changeDetector) { | ||
ListWrapper.remove(this._changeDetectorRefs, changeDetector); | ||
ApplicationRef_.prototype.detachView = function (viewRef) { | ||
var view = viewRef.internalView; | ||
ListWrapper.remove(this._views, view); | ||
view.detach(); | ||
}; | ||
@@ -416,5 +450,4 @@ ApplicationRef_.prototype.bootstrap = function (componentOrFactory) { | ||
}; | ||
/** @internal */ | ||
ApplicationRef_.prototype._loadComponent = function (componentRef) { | ||
this._changeDetectorRefs.push(componentRef.changeDetectorRef); | ||
this.attachView(componentRef.hostView); | ||
this.tick(); | ||
@@ -427,8 +460,4 @@ this._rootComponents.push(componentRef); | ||
}; | ||
/** @internal */ | ||
ApplicationRef_.prototype._unloadComponent = function (componentRef) { | ||
if (this._rootComponents.indexOf(componentRef) == -1) { | ||
return; | ||
} | ||
this.unregisterChangeDetector(componentRef.changeDetectorRef); | ||
this.detachView(componentRef.hostView); | ||
ListWrapper.remove(this._rootComponents, componentRef); | ||
@@ -443,5 +472,5 @@ }; | ||
this._runningTick = true; | ||
this._changeDetectorRefs.forEach(function (detector) { return detector.detectChanges(); }); | ||
this._views.forEach(function (view) { return view.ref.detectChanges(); }); | ||
if (this._enforceNoNewChanges) { | ||
this._changeDetectorRefs.forEach(function (detector) { return detector.checkNoChanges(); }); | ||
this._views.forEach(function (view) { return view.ref.checkNoChanges(); }); | ||
} | ||
@@ -456,4 +485,9 @@ } | ||
// TODO(alxhub): Dispose of the NgZone. | ||
this._rootComponents.slice().forEach(function (component) { return component.destroy(); }); | ||
this._views.slice().forEach(function (view) { return view.destroy(); }); | ||
}; | ||
Object.defineProperty(ApplicationRef_.prototype, "viewCount", { | ||
get: function () { return this._views.length; }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ApplicationRef_.prototype, "componentTypes", { | ||
@@ -460,0 +494,0 @@ get: function () { return this._rootComponentTypes; }, |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"getPlatform":{"__symbolic":"function","parameters":[],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"error","message":"Reference to a local symbol","line":30,"character":4,"context":{"name":"_platform"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"error","message":"Reference to a local symbol","line":30,"character":4,"context":{"name":"_platform"}}}},"thenExpression":{"__symbolic":"error","message":"Reference to a local symbol","line":30,"character":4,"context":{"name":"_platform"}},"elseExpression":null}},"PlatformRef_":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"./di","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./di","name":"Injector"}]}],"onDestroy":[{"__symbolic":"method"}],"destroy":[{"__symbolic":"method"}],"bootstrapModuleFactory":[{"__symbolic":"method"}],"_bootstrapModuleFactoryWithZone":[{"__symbolic":"method"}],"bootstrapModule":[{"__symbolic":"method"}],"_bootstrapModuleWithZone":[{"__symbolic":"method"}],"_moduleDoBootstrap":[{"__symbolic":"method"}]}},"ApplicationRef_":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"./di","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,null,null,null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"./di","name":"Optional"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"./di","name":"Optional"}}]],"parameters":[{"__symbolic":"reference","module":"./zone/ng_zone","name":"NgZone"},{"__symbolic":"reference","module":"./console","name":"Console"},{"__symbolic":"reference","module":"./di","name":"Injector"},{"__symbolic":"reference","module":"../src/error_handler","name":"ErrorHandler"},{"__symbolic":"reference","module":"./linker/component_factory_resolver","name":"ComponentFactoryResolver"},{"__symbolic":"reference","module":"./application_init","name":"ApplicationInitStatus"},{"__symbolic":"reference","module":"./testability/testability","name":"TestabilityRegistry"},{"__symbolic":"reference","module":"./testability/testability","name":"Testability"}]}],"registerChangeDetector":[{"__symbolic":"method"}],"unregisterChangeDetector":[{"__symbolic":"method"}],"bootstrap":[{"__symbolic":"method"}],"_loadComponent":[{"__symbolic":"method"}],"_unloadComponent":[{"__symbolic":"method"}],"tick":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]},"statics":{"_tickScope":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"./profile/profile","name":"wtfCreateScope"},"arguments":["ApplicationRef#tick()"]}}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"getPlatform":{"__symbolic":"function","parameters":[],"value":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"error","message":"Reference to a local symbol","line":32,"character":4,"context":{"name":"_platform"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"error","message":"Reference to a local symbol","line":32,"character":4,"context":{"name":"_platform"}}}},"thenExpression":{"__symbolic":"error","message":"Reference to a local symbol","line":32,"character":4,"context":{"name":"_platform"}},"elseExpression":null}},"PlatformRef_":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"./di","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./di","name":"Injector"}]}],"onDestroy":[{"__symbolic":"method"}],"destroy":[{"__symbolic":"method"}],"bootstrapModuleFactory":[{"__symbolic":"method"}],"_bootstrapModuleFactoryWithZone":[{"__symbolic":"method"}],"bootstrapModule":[{"__symbolic":"method"}],"_bootstrapModuleWithZone":[{"__symbolic":"method"}],"_moduleDoBootstrap":[{"__symbolic":"method"}]}},"ApplicationRef_":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"./di","name":"Injectable"}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,null,null,null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"./di","name":"Optional"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"./di","name":"Optional"}}]],"parameters":[{"__symbolic":"reference","module":"./zone/ng_zone","name":"NgZone"},{"__symbolic":"reference","module":"./console","name":"Console"},{"__symbolic":"reference","module":"./di","name":"Injector"},{"__symbolic":"reference","module":"../src/error_handler","name":"ErrorHandler"},{"__symbolic":"reference","module":"./linker/component_factory_resolver","name":"ComponentFactoryResolver"},{"__symbolic":"reference","module":"./application_init","name":"ApplicationInitStatus"},{"__symbolic":"reference","module":"./testability/testability","name":"TestabilityRegistry"},{"__symbolic":"reference","module":"./testability/testability","name":"Testability"}]}],"attachView":[{"__symbolic":"method"}],"detachView":[{"__symbolic":"method"}],"bootstrap":[{"__symbolic":"method"}],"_loadComponent":[{"__symbolic":"method"}],"_unloadComponent":[{"__symbolic":"method"}],"tick":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]},"statics":{"_tickScope":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"./profile/profile","name":"wtfCreateScope"},"arguments":["ApplicationRef#tick()"]}}}}} |
@@ -16,3 +16,3 @@ /** | ||
export * from './di'; | ||
export { createPlatform, assertPlatform, destroyPlatform, getPlatform, PlatformRef, ApplicationRef, enableProdMode, isDevMode, createPlatformFactory } from './application_ref'; | ||
export { createPlatform, assertPlatform, destroyPlatform, getPlatform, PlatformRef, ApplicationRef, enableProdMode, isDevMode, createPlatformFactory, NgProbeToken } from './application_ref'; | ||
export { APP_ID, PACKAGE_ROOT_URL, PLATFORM_INITIALIZER, APP_BOOTSTRAP_LISTENER } from './application_tokens'; | ||
@@ -19,0 +19,0 @@ export { APP_INITIALIZER, ApplicationInitStatus } from './application_init'; |
@@ -16,3 +16,3 @@ /** | ||
export * from './di'; | ||
export { createPlatform, assertPlatform, destroyPlatform, getPlatform, PlatformRef, ApplicationRef, enableProdMode, isDevMode, createPlatformFactory } from './application_ref'; | ||
export { createPlatform, assertPlatform, destroyPlatform, getPlatform, PlatformRef, ApplicationRef, enableProdMode, isDevMode, createPlatformFactory, NgProbeToken } from './application_ref'; | ||
export { APP_ID, PACKAGE_ROOT_URL, PLATFORM_INITIALIZER, APP_BOOTSTRAP_LISTENER } from './application_tokens'; | ||
@@ -19,0 +19,0 @@ export { APP_INITIALIZER, ApplicationInitStatus } from './application_init'; |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./metadata"},{"from":"./util"},{"from":"./di"},{"from":"./application_ref","export":["createPlatform","assertPlatform","destroyPlatform","getPlatform","PlatformRef","ApplicationRef","enableProdMode","isDevMode","createPlatformFactory"]},{"from":"./application_tokens","export":["APP_ID","PACKAGE_ROOT_URL","PLATFORM_INITIALIZER","APP_BOOTSTRAP_LISTENER"]},{"from":"./application_init","export":["APP_INITIALIZER","ApplicationInitStatus"]},{"from":"./zone"},{"from":"./render"},{"from":"./linker"},{"from":"./debug/debug_node","export":["DebugElement","DebugNode","asNativeElements","getDebugNode"]},{"from":"./testability/testability","export":["GetTestability","Testability","TestabilityRegistry","setTestabilityGetter"]},{"from":"./change_detection"},{"from":"./platform_core_providers"},{"from":"./i18n/tokens","export":["TRANSLATIONS","TRANSLATIONS_FORMAT","LOCALE_ID"]},{"from":"./application_module","export":["ApplicationModule"]},{"from":"./profile/profile","export":["wtfCreateScope","wtfLeave","wtfStartTimeRange","wtfEndTimeRange","WtfScopeFn"]},{"from":"./type","export":["Type"]},{"from":"./facade/async","export":["EventEmitter"]},{"from":"./error_handler","export":["ErrorHandler"]},{"from":"./core_private_export"},{"from":"./animation/metadata"},{"from":"./animation/animation_transition_event","export":["AnimationTransitionEvent"]},{"from":"./animation/animation_player","export":["AnimationPlayer"]},{"from":"./security","export":["Sanitizer","SecurityContext"]}]} | ||
{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./metadata"},{"from":"./util"},{"from":"./di"},{"from":"./application_ref","export":["createPlatform","assertPlatform","destroyPlatform","getPlatform","PlatformRef","ApplicationRef","enableProdMode","isDevMode","createPlatformFactory","NgProbeToken"]},{"from":"./application_tokens","export":["APP_ID","PACKAGE_ROOT_URL","PLATFORM_INITIALIZER","APP_BOOTSTRAP_LISTENER"]},{"from":"./application_init","export":["APP_INITIALIZER","ApplicationInitStatus"]},{"from":"./zone"},{"from":"./render"},{"from":"./linker"},{"from":"./debug/debug_node","export":["DebugElement","DebugNode","asNativeElements","getDebugNode"]},{"from":"./testability/testability","export":["GetTestability","Testability","TestabilityRegistry","setTestabilityGetter"]},{"from":"./change_detection"},{"from":"./platform_core_providers"},{"from":"./i18n/tokens","export":["TRANSLATIONS","TRANSLATIONS_FORMAT","LOCALE_ID"]},{"from":"./application_module","export":["ApplicationModule"]},{"from":"./profile/profile","export":["wtfCreateScope","wtfLeave","wtfStartTimeRange","wtfEndTimeRange","WtfScopeFn"]},{"from":"./type","export":["Type"]},{"from":"./facade/async","export":["EventEmitter"]},{"from":"./error_handler","export":["ErrorHandler"]},{"from":"./core_private_export"},{"from":"./animation/metadata"},{"from":"./animation/animation_transition_event","export":["AnimationTransitionEvent"]},{"from":"./animation/animation_player","export":["AnimationPlayer"]},{"from":"./security","export":["Sanitizer","SecurityContext"]}]} |
@@ -6,3 +6,3 @@ import { ChangeDetectorRef } from '../change_detection/change_detector_ref'; | ||
*/ | ||
export declare abstract class ViewRef { | ||
export declare abstract class ViewRef extends ChangeDetectorRef { | ||
destroyed: boolean; | ||
@@ -9,0 +9,0 @@ abstract onDestroy(callback: Function): any; |
@@ -14,2 +14,3 @@ /** | ||
import { triggerQueuedAnimations } from '../animation/animation_queue'; | ||
import { ChangeDetectorRef } from '../change_detection/change_detector_ref'; | ||
import { ChangeDetectorStatus } from '../change_detection/constants'; | ||
@@ -20,4 +21,6 @@ import { unimplemented } from '../facade/errors'; | ||
*/ | ||
export var ViewRef = (function () { | ||
export var ViewRef = (function (_super) { | ||
__extends(ViewRef, _super); | ||
function ViewRef() { | ||
_super.apply(this, arguments); | ||
} | ||
@@ -30,3 +33,3 @@ Object.defineProperty(ViewRef.prototype, "destroyed", { | ||
return ViewRef; | ||
}()); | ||
}(ChangeDetectorRef)); | ||
/** | ||
@@ -33,0 +36,0 @@ * Represents an Angular View. |
@@ -8,2 +8,3 @@ /** | ||
*/ | ||
import { ApplicationRef } from '../application_ref'; | ||
import { ChangeDetectorRef, ChangeDetectorStatus } from '../change_detection/change_detection'; | ||
@@ -38,2 +39,3 @@ import { Injector } from '../di/injector'; | ||
viewContainer: ViewContainer; | ||
appRef: ApplicationRef; | ||
numberOfChecks: number; | ||
@@ -80,2 +82,3 @@ renderer: Renderer; | ||
private _renderDetach(); | ||
attachToAppRef(appRef: ApplicationRef): void; | ||
attachAfter(viewContainer: ViewContainer, prevView: AppView<any>): void; | ||
@@ -82,0 +85,0 @@ moveAfter(viewContainer: ViewContainer, prevView: AppView<any>): void; |
@@ -46,3 +46,2 @@ /** | ||
this.declaredViewContainer = declaredViewContainer; | ||
this.viewContainer = null; | ||
this.numberOfChecks = 0; | ||
@@ -125,8 +124,11 @@ this.ref = new ViewRef_(this); | ||
AppView.prototype.detachAndDestroy = function () { | ||
if (this._hasExternalHostElement) { | ||
if (this.viewContainer) { | ||
this.viewContainer.detachView(this.viewContainer.nestedViews.indexOf(this)); | ||
} | ||
else if (this.appRef) { | ||
this.appRef.detachView(this.ref); | ||
} | ||
else if (this._hasExternalHostElement) { | ||
this.detach(); | ||
} | ||
else if (isPresent(this.viewContainer)) { | ||
this.viewContainer.detachView(this.viewContainer.nestedViews.indexOf(this)); | ||
} | ||
this.destroy(); | ||
@@ -183,2 +185,3 @@ }; | ||
} | ||
this.appRef = null; | ||
this.viewContainer = null; | ||
@@ -195,3 +198,13 @@ this.dirtyParentQueriesInternal(); | ||
}; | ||
AppView.prototype.attachToAppRef = function (appRef) { | ||
if (this.viewContainer) { | ||
throw new Error('This view is already attached to a ViewContainer!'); | ||
} | ||
this.appRef = appRef; | ||
this.dirtyParentQueriesInternal(); | ||
}; | ||
AppView.prototype.attachAfter = function (viewContainer, prevView) { | ||
if (this.appRef) { | ||
throw new Error('This view is already attached directly to the ApplicationRef!'); | ||
} | ||
this._renderAttach(viewContainer, prevView); | ||
@@ -198,0 +211,0 @@ this.viewContainer = viewContainer; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2111022
30629
3
7