Skip to content

Commit 11ea763

Browse files
committed
Update renderer to run against beta 0.
1 parent f62b7e3 commit 11ea763

File tree

6 files changed

+46
-27
lines changed

6 files changed

+46
-27
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
},
1515
"scripts": {},
1616
"dependencies": {
17-
"angular2": "2.0.0-alpha.46",
18-
"@reactivex/rxjs": "5.0.0-alpha.7",
17+
"angular2": "2.0.0-beta.0",
1918
"parse5": "1.4.2",
2019
"punycode": "1.3.2",
2120
"querystring": "0.2.0",
2221
"url": "0.10.3",
2322
"reflect-metadata": "0.1.2",
24-
"zone.js": "0.5.8"
23+
"rxjs": "5.0.0-beta.0",
24+
"zone.js": "0.5.10"
2525
},
2626
"devDependencies": {
2727
"grunt": "0.4.5",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Type, ApplicationRef, Provider } from 'angular2/angular2';
1+
import { Type, ApplicationRef, Provider } from 'angular2/core';
22

33
export type BindingArray = Array<Type | Provider | Array<any>>;
44
export function nativeScriptBootstrap(appComponentType: any, componentInjectableBindings?: BindingArray): Promise<ApplicationRef>;

src/nativescript-angular/application.ts

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,49 @@ import './polyfills/array';
33
import './zone';
44
import {isPresent, Type} from 'angular2/src/facade/lang';
55
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
6-
import {ComponentRef} from 'angular2/src/core/linker/dynamic_component_loader';
6+
import {platform, ComponentRef, PLATFORM_DIRECTIVES, PLATFORM_PIPES} from 'angular2/core';
77
import {bind, provide, Provider} from 'angular2/src/core/di';
8-
import {DOM} from 'angular2/src/core/dom/dom_adapter';
8+
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
99

1010
import {Renderer} from 'angular2/src/core/render/api';
1111
import {NativeScriptRenderer} from './renderer';
1212
import {NativeScriptDomAdapter} from './dom_adapter';
1313
import {XHR} from 'angular2/src/compiler/xhr';
1414
import {FileSystemXHR} from './xhr';
15-
import {Parse5DomAdapter} from 'angular2/src/core/dom/parse5_adapter';
15+
import {Parse5DomAdapter} from 'angular2/src/platform/server/parse5_adapter';
16+
import {ExceptionHandler} from 'angular2/src/facade/exception_handler';
17+
import {APPLICATION_COMMON_PROVIDERS} from 'angular2/src/core/application_common_providers';
18+
import {COMPILER_PROVIDERS} from 'angular2/src/compiler/compiler';
19+
import {PLATFORM_COMMON_PROVIDERS} from 'angular2/src/core/platform_common_providers';
20+
import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS} from "angular2/common";
1621

17-
import {bootstrap as angularBootstrap} from 'angular2/src/core/application';
18-
import {commonBootstrap} from 'angular2/src/core/application_common';
22+
import {bootstrap as angularBootstrap} from 'angular2/bootstrap';
1923

20-
21-
export type BindingArray = Array<Type | Provider | any[]>;
24+
export type ProviderArray = Array<Type | Provider | any[]>;
2225

2326
export function nativeScriptBootstrap(appComponentType: any,
24-
componentInjectableBindings: BindingArray = null): Promise<ComponentRef> {
27+
customProviders: ProviderArray = null): Promise<ComponentRef> {
2528
NativeScriptDomAdapter.makeCurrent();
2629

27-
let nativeScriptBindings: BindingArray = [
30+
let nativeScriptProviders: ProviderArray = [
2831
NativeScriptRenderer,
2932
provide(Renderer, {useClass: NativeScriptRenderer}),
3033
provide(XHR, {useClass: FileSystemXHR}),
34+
provide(ExceptionHandler, {useFactory: () => new ExceptionHandler(DOM, true), deps: []}),
35+
36+
provide(PLATFORM_PIPES, {useValue: COMMON_PIPES, multi: true}),
37+
provide(PLATFORM_DIRECTIVES, {useValue: COMMON_DIRECTIVES, multi: true}),
38+
39+
APPLICATION_COMMON_PROVIDERS,
40+
COMPILER_PROVIDERS,
41+
PLATFORM_COMMON_PROVIDERS,
42+
FORM_PROVIDERS,
3143
];
32-
var bindings = [nativeScriptBindings];
33-
if (isPresent(componentInjectableBindings)) {
34-
bindings.push(componentInjectableBindings);
44+
45+
var appProviders = [];
46+
if (isPresent(customProviders)) {
47+
appProviders.push(customProviders);
3548
}
3649

37-
return angularBootstrap(appComponentType, bindings)
50+
return platform(nativeScriptProviders).application(appProviders).bootstrap(appComponentType);
3851
}

src/nativescript-angular/dom_adapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {Parse5DomAdapter} from 'angular2/src/core/dom/parse5_adapter';
2-
import {setRootDomAdapter} from 'angular2/src/core/dom/dom_adapter';
1+
import {Parse5DomAdapter} from 'angular2/src/platform/server/parse5_adapter';
2+
import {setRootDomAdapter} from 'angular2/src/platform/dom/dom_adapter';
33
import {Type} from 'angular2/src/facade/lang';
44

55
export class NativeScriptDomAdapter extends Parse5DomAdapter {

src/nativescript-angular/renderer.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {Inject, Injectable} from 'angular2/src/core/di';
22
import {RenderComponentTemplate} from 'angular2/src/core/render/api';
3-
import {DOCUMENT} from 'angular2/src/core/render/dom/dom_tokens';
43
import {createRenderView, NodeFactory} from 'angular2/src/core/render/view_factory';
54
import {
65
Renderer,
@@ -18,19 +17,16 @@ import {
1817
DefaultRenderView,
1918
DefaultRenderFragmentRef
2019
} from 'angular2/src/core/render/view';
21-
import {DOM} from 'angular2/src/core/dom/dom_adapter';
20+
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
2221
import {ViewNode, DummyViewNode} from './view_node';
2322

2423
//var console = {log: function(msg) {}}
2524

2625
@Injectable()
2726
export class NativeScriptRenderer extends Renderer implements NodeFactory<ViewNode> {
28-
private _document;
29-
30-
constructor(@Inject(DOCUMENT) document) {
27+
constructor() {
3128
super();
3229
console.log('NativeScriptRenderer created');
33-
this._document = document;
3430
}
3531

3632
public createProtoView(componentTemplateId: string, cmds: RenderTemplateCmd[]): RenderProtoViewRef {
@@ -153,6 +149,16 @@ export class NativeScriptRenderer extends Renderer implements NodeFactory<ViewNo
153149
node.setStyleProperty(styleName, styleValue);
154150
}
155151

152+
/**
153+
* Used only in debug mode to serialize property changes to comment nodes,
154+
* such as <template> placeholders.
155+
*/
156+
setBindingDebugInfo(location: RenderElementRef, propertyName: string, propertyValue: string): void {
157+
let node = resolveBoundNode(location);
158+
console.log('NativeScriptRenderer.setBindingDebugInfo: ' + node.viewName + ', ' + propertyName + ' = ' + propertyValue);
159+
}
160+
161+
156162
getNativeElementSync(location: RenderElementRef): any {
157163
console.log("NativeScriptRenderer.getNativeElementSync");
158164

src/nativescript-angular/zone.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import NativeScriptPatch from "./zone_patch"
44

55
var core = require('zone.js/lib/core.js');
66

7-
var zone = global.zone = new core.Zone()
8-
console.log('Created zone.');
7+
global.Zone = core.Zone;
8+
global.zone = new core.Zone();
99

1010
NativeScriptPatch.apply();

0 commit comments

Comments
 (0)