本文整理匯總了TypeScript中angular2/core.NgZone類的典型用法代碼示例。如果您正苦於以下問題:TypeScript NgZone類的具體用法?TypeScript NgZone怎麽用?TypeScript NgZone使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了NgZone類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
touchid.authenticate((result) => {
this.ngZone.run(() => {
this.nav.push(GraphPage,{
attractionId: attractionId
});
});
}, (error) => {
示例2: update
/**
* Update the state of the node based on selection
* @param {Boolean} isSelected
*/
update(isSelected) {
this.node.isSelected = isSelected;
this.borderColor = this.node.isSelected ? '#0074D9' :
'rgba(0, 0, 0, 0.125)';
this.color = this.node.isSelected ? '#222' : '#888';
this._ngZone.run(() => undefined);
}
示例3: setTimeout
this.openModal(null,{ready:()=> {
setTimeout(() => this.operationSelect.refresh(),0);
this.zone.run(()=> {
this.listOperations();
this.createChart(this.operations);
});
}});
示例4:
data.forEach((user) => {
if(user.uid !== this.firebaseService.getMyUid()) {
console.log("Adding:"+JSON.stringify(user));
this.nameList.push(user);
this.zone.run(() => this.nameClassifier.addToUserList(user));
isSortingNeeded = true;
}
});
示例5:
Tracker.autorun(() => zone.run(() => {
this.cartList = Carts.find({'ip':myip}).fetch();
if(Carts.find({'ip':myip}).count() == 1){
this.open('right');
}
}));
示例6:
this.autorunComputation = Tracker.autorun(() => {
this.zone.run(() => {
this.currentUser = Meteor.user();
this.currentUserId = Meteor.userId();
this.isLoggingIn = Meteor.loggingIn();
this.isLoggedIn = !!Meteor.user();
})
});
示例7: ResponseOptions
res.on('end', () => {
let responseOptions = new ResponseOptions({body, status, headers, url});
let response = new Response(responseOptions);
if (utils.isSuccess(status)) {
ngZome.run(() => {
responseObserver.next(response);
});
ngZome.run(() => {
responseObserver.complete();
});
return;
}
ngZome.run(() => {
responseObserver.error(response);
});
});
示例8:
worker.run({ elapsedTime: true }).subscribe((e) => {
this.zone.run(() => {
this.timeElapsed = e.elapsedTime + "";
this.ranCode = worker.workerBody;
this.output = e.data;
});
});
示例9: Photo
}).then(fileUrl => {
let photo = new Photo();
photo.filePath = fileUrl;
console.log("fileUrl: ", fileUrl);
this.ngZone.run( () => {
this.photos.push(photo);
});
}).catch(error => {
示例10: Observable
this.response = new Observable(responseObserver => {
let nodeReq;
ngZome.run(() => {
// http or https
let xhrHttp: any = http;
if (reqInfo.protocol === 'https:') {
xhrHttp = https;
}
nodeReq = xhrHttp.request(reqInfo, (res: http.IncomingMessage) => {
let body = '';
res.on('data', (chunk) => body += chunk);
let status = res.statusCode;
let headers = new Headers(res.headers);
let url = res.url;
res.on('end', () => {
let responseOptions = new ResponseOptions({body, status, headers, url});
let response = new Response(responseOptions);
if (utils.isSuccess(status)) {
ngZome.run(() => {
responseObserver.next(response);
});
ngZome.run(() => {
responseObserver.complete();
});
return;
}
ngZome.run(() => {
responseObserver.error(response);
});
});
});
});
let onError = (err) => {
let responseOptions = new ResponseOptions({body: err, type: ResponseType.Error});
if (isPresent(baseResponseOptions)) {
responseOptions = baseResponseOptions.merge(responseOptions);
}
ngZome.run(() => {
responseObserver.error(new Response(responseOptions));
});
};
nodeReq.on('error', onError);
nodeReq.write(req.text());
nodeReq.end();
return () => {
nodeReq.removeListener('error', onError);
nodeReq.abort();
};
});