Skip to content

Commit

Permalink
Merge pull request #162 from NativeScript/beta-14
Browse files Browse the repository at this point in the history
chore: update to beta.14
  • Loading branch information
vakrilov committed Apr 11, 2016
2 parents 55f16bb + 0029fa1 commit 77b9437
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 46 deletions.
2 changes: 1 addition & 1 deletion ng-sample/app/examples/action-bar/action-bar-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Component} from 'angular2/core';
import {RouteConfig} from 'angular2/router';
import { Page} from "ui/page";
import {NS_ROUTER_DIRECTIVES, NS_ROUTER_PROVIDERS} from "../../nativescript-angular/router/ns-router";
import {NS_DIRECTIVES} from "../../nativescript-angular/directives/ns-directives";
import {NS_DIRECTIVES} from "../../nativescript-angular/directives";

@Component({
selector: "first",
Expand Down
41 changes: 20 additions & 21 deletions ng-sample/app/performance/benchmark.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import {StackLayout} from 'ui/layouts/stack-layout';
import {Button} from 'ui/button';
import {Label} from 'ui/label';
import {Inject, Component, View} from 'angular2/core';
import {Inject, Component} from 'angular2/core';
import {ApplicationRef} from 'angular2/src/core/application_ref';
import * as profiling from './profiling';

@Component({selector: 'tree', inputs: ['data']})
@View({
directives: [TreeComponent],
template:
`<StackLayout>
@Component({
selector: 'tree',
inputs: ['data'],
directives: [TreeComponent],
template:
`<StackLayout>
<Label [text]="data.value"></Label>
<StackLayout *ngIf="data.right != null">
<tree [data]='data.right'></tree>
Expand All @@ -21,15 +22,13 @@ import * as profiling from './profiling';
`
})
class TreeComponent {
data: TreeNode;
data: TreeNode;
}

@Component({
selector: 'benchmark',
})
@View({
selector: 'benchmark',
directives: [TreeComponent],
template: `
template: `
<StackLayout>
<Label text='Benchmark!' fontSize='20' verticalAlignment='center' padding='20'></Label>
<Button text="Baseline test" (tap)="baselineTest(baseline)"></Button>
Expand Down Expand Up @@ -88,29 +87,29 @@ export class Benchmark {

private createBaselineDom() {
var values = this.count++ % 2 == 0 ? ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*'] :
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', '-'];
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', '-'];
this.initDataBaseline = buildTree(this.maxDepth, values, 0);
this.appRef.tick();
}

private createNgDom() {
var values = this.count++ % 2 == 0 ? ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*'] :
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', '-'];
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', '-'];
this.initDataNg = buildTree(this.maxDepth, values, 0);
this.appRef.tick();
}
}


export class TreeNode {
value: string;
left: TreeNode;
right: TreeNode;
constructor(value, left, right) {
this.value = value;
this.left = left;
this.right = right;
}
value: string;
left: TreeNode;
right: TreeNode;
constructor(value, left, right) {
this.value = value;
this.left = left;
this.right = right;
}
}

var nodes = 0;
Expand Down
7 changes: 4 additions & 3 deletions ng-sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@
},
"homepage": "https://github.com/NativeScript/template-hello-world",
"dependencies": {
"tns-core-modules": "^2.0.0-angular-3",
"tns-core-modules": "^2.0.0-angular-4",
"nativescript-intl": "^0.0.2",
"angular2": "2.0.0-beta.9",
"angular2": "2.0.0-beta.14",
"es6-shim": "^0.35.0",
"parse5": "1.4.2",
"punycode": "1.3.2",
"querystring": "0.2.0",
"url": "0.10.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"zone.js": "0.5.15"
"zone.js": "^0.6.6"
},
"devDependencies": {
"grunt": "0.4.5",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"scripts": {},
"dependencies": {
"nativescript-intl": "^0.0.2",
"angular2": "2.0.0-beta.9",
"es6-shim": "^0.33.3",
"angular2": "2.0.0-beta.14",
"es6-shim": "^0.35.0",
"parse5": "1.4.2",
"punycode": "1.3.2",
"querystring": "0.2.0",
"url": "0.10.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"zone.js": "0.5.15"
"zone.js": "^0.6.6"
},
"devDependencies": {
"grunt": "0.4.5",
Expand All @@ -37,7 +37,7 @@
"typescript": "1.8.2"
},
"peerDependencies": {
"tns-core-modules": ">=2.0.0 || >=2.0.0-2016 || >=2.0.0-angular-3"
"tns-core-modules": ">=2.0.0 || >=2.0.0-2016 || >=2.0.0-angular-4"
},
"nativescript": {}
}
13 changes: 1 addition & 12 deletions src/nativescript-angular/application.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
//prevent a crash in zone patches. pretend we're node.js
global.process = {};
const oldToString = Object.prototype.toString;
Object.prototype.toString = function() {
return "[object process]";
}
import "zone.js/dist/zone.js"
Object.prototype.toString = oldToString;
delete global.process;
//
//Import globals after the zone, so the latter can't patch everything there.
//The patchables should already be zone-aware already.
import 'globals';
import "zone.js/dist/zone-node"

import 'reflect-metadata';
import './polyfills/array';
Expand Down
2 changes: 1 addition & 1 deletion src/nativescript-angular/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class NativeScriptRenderer extends Renderer {

public listen(renderElement: NgView, eventName: string, callback: Function): Function {
traceLog('NativeScriptRenderer.listen: ' + eventName);
let zonedCallback = (<any>global).zone.bind(callback);
let zonedCallback = (<any>global).Zone.current.wrap(callback);
renderElement.on(eventName, zonedCallback);
return () => renderElement.off(eventName, zonedCallback);
}
Expand Down
2 changes: 1 addition & 1 deletion src/nativescript-angular/router/page-router-outlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class PageRouterOutlet extends RouterOutlet {
resolve(componentRef)
});

page.on('navigatingFrom', (<any>global).zone.bind((args: NavigatedData) => {
page.on('navigatingFrom', (<any>global).Zone.current.wrap((args: NavigatedData) => {
if (args.isBackNavigation) {
this.location.beginBackPageNavigation();
this.location.back();
Expand Down
7 changes: 4 additions & 3 deletions tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@
},
"homepage": "http://nativescript.org",
"dependencies": {
"tns-core-modules": "2.0.0-angular-3",
"tns-core-modules": "^2.0.0-angular-4",
"nativescript-intl": "^0.0.2",
"angular2": "2.0.0-beta.9",
"angular2": "2.0.0-beta.14",
"es6-shim": "^0.35.0",
"nativescript-unit-test-runner": "^0.3.3",
"parse5": "1.4.2",
"punycode": "1.3.2",
"querystring": "0.2.0",
"reflect-metadata": "0.1.2",
"url": "0.10.3",
"rxjs": "5.0.0-beta.2",
"zone.js": "0.5.15"
"zone.js": "^0.6.6"
},
"devDependencies": {
"chai": "^3.5.0",
Expand Down

0 comments on commit 77b9437

Please sign in to comment.