add types
This commit is contained in:
parent
0499eeb231
commit
3519714f64
|
@ -17,7 +17,10 @@ import {ProtoChangeDetector, DynamicProtoChangeDetector, JitProtoChangeDetector}
|
||||||
from './src/change_detection/proto_change_detector';
|
from './src/change_detection/proto_change_detector';
|
||||||
|
|
||||||
export class ChangeDetection {
|
export class ChangeDetection {
|
||||||
createProtoChangeDetector(name:string){}
|
createProtoChangeDetector(name:string):ProtoChangeDetector{
|
||||||
|
// TODO: this should be abstract, once supported in AtScript
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DynamicChangeDetection extends ChangeDetection {
|
export class DynamicChangeDetection extends ChangeDetection {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {TemplateLoader} from './compiler/template_loader';
|
||||||
import {DirectiveMetadataReader} from './compiler/directive_metadata_reader';
|
import {DirectiveMetadataReader} from './compiler/directive_metadata_reader';
|
||||||
import {DirectiveMetadata} from './compiler/directive_metadata';
|
import {DirectiveMetadata} from './compiler/directive_metadata';
|
||||||
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
import {VmTurnZone} from 'angular2/src/core/zone/vm_turn_zone';
|
import {VmTurnZone} from 'angular2/src/core/zone/vm_turn_zone';
|
||||||
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
||||||
import {ShadowDomStrategy, NativeShadowDomStrategy} from 'angular2/src/core/compiler/shadow_dom_strategy';
|
import {ShadowDomStrategy, NativeShadowDomStrategy} from 'angular2/src/core/compiler/shadow_dom_strategy';
|
||||||
|
@ -17,6 +17,7 @@ import {XHR} from 'angular2/src/core/compiler/xhr/xhr';
|
||||||
import {XHRImpl} from 'angular2/src/core/compiler/xhr/xhr_impl';
|
import {XHRImpl} from 'angular2/src/core/compiler/xhr/xhr_impl';
|
||||||
import {EventManager} from 'angular2/src/core/events/event_manager';
|
import {EventManager} from 'angular2/src/core/events/event_manager';
|
||||||
import {HammerGesturesPlugin} from 'angular2/src/core/events/hammer_gestures';
|
import {HammerGesturesPlugin} from 'angular2/src/core/events/hammer_gestures';
|
||||||
|
import {Binding} from 'angular2/src/di/binding';
|
||||||
|
|
||||||
var _rootInjector: Injector;
|
var _rootInjector: Injector;
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ export var appElementToken = new OpaqueToken('AppElement');
|
||||||
export var appComponentAnnotatedTypeToken = new OpaqueToken('AppComponentAnnotatedType');
|
export var appComponentAnnotatedTypeToken = new OpaqueToken('AppComponentAnnotatedType');
|
||||||
export var appDocumentToken = new OpaqueToken('AppDocument');
|
export var appDocumentToken = new OpaqueToken('AppDocument');
|
||||||
|
|
||||||
function _injectorBindings(appComponentType) {
|
function _injectorBindings(appComponentType): List<Binding> {
|
||||||
return [
|
return [
|
||||||
bind(appDocumentToken).toValue(DOM.defaultDoc()),
|
bind(appDocumentToken).toValue(DOM.defaultDoc()),
|
||||||
bind(appComponentAnnotatedTypeToken).toFactory((reader) => {
|
bind(appComponentAnnotatedTypeToken).toFactory((reader) => {
|
||||||
|
@ -88,7 +89,7 @@ function _injectorBindings(appComponentType) {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function _createVmZone(givenReporter:Function){
|
function _createVmZone(givenReporter:Function): VmTurnZone {
|
||||||
var defaultErrorReporter = (exception, stackTrace) => {
|
var defaultErrorReporter = (exception, stackTrace) => {
|
||||||
var longStackTrace = ListWrapper.join(stackTrace, "\n\n-----async gap-----\n");
|
var longStackTrace = ListWrapper.join(stackTrace, "\n\n-----async gap-----\n");
|
||||||
print(`${exception}\n\n${longStackTrace}`);
|
print(`${exception}\n\n${longStackTrace}`);
|
||||||
|
@ -104,7 +105,7 @@ function _createVmZone(givenReporter:Function){
|
||||||
|
|
||||||
// Multiple calls to this method are allowed. Each application would only share
|
// Multiple calls to this method are allowed. Each application would only share
|
||||||
// _rootInjector, which is not user-configurable by design, thus safe to share.
|
// _rootInjector, which is not user-configurable by design, thus safe to share.
|
||||||
export function bootstrap(appComponentType: Type, bindings=null, givenBootstrapErrorReporter=null) {
|
export function bootstrap(appComponentType: Type, bindings: List<Binding>=null, givenBootstrapErrorReporter: Function=null): Promise {
|
||||||
var bootstrapProcess = PromiseWrapper.completer();
|
var bootstrapProcess = PromiseWrapper.completer();
|
||||||
|
|
||||||
var zone = _createVmZone(givenBootstrapErrorReporter);
|
var zone = _createVmZone(givenBootstrapErrorReporter);
|
||||||
|
@ -132,7 +133,7 @@ export function bootstrap(appComponentType: Type, bindings=null, givenBootstrapE
|
||||||
return bootstrapProcess.promise;
|
return bootstrapProcess.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _createAppInjector(appComponentType: Type, bindings: List, zone: VmTurnZone): Injector {
|
function _createAppInjector(appComponentType: Type, bindings: List<Binding>, zone: VmTurnZone): Injector {
|
||||||
if (isBlank(_rootInjector)) _rootInjector = new Injector(_rootBindings);
|
if (isBlank(_rootInjector)) _rootInjector = new Injector(_rootBindings);
|
||||||
var mergedBindings = isPresent(bindings) ?
|
var mergedBindings = isPresent(bindings) ?
|
||||||
ListWrapper.concat(_injectorBindings(appComponentType), bindings) :
|
ListWrapper.concat(_injectorBindings(appComponentType), bindings) :
|
||||||
|
|
Loading…
Reference in New Issue