本文整理汇总了TypeScript中timer.setTimeout函数的典型用法代码示例。如果您正苦于以下问题:TypeScript setTimeout函数的具体用法?TypeScript setTimeout怎么用?TypeScript setTimeout使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTimeout函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor() {
disable();
// >> setting-specific-tracing-categories
setCategories(categories.concat(
categories.Binding,
categories.Layout,
categories.Style,
categories.ViewHierarchy,
categories.VisualTreeEvents
));
enable();
// << setting-specific-tracing-categories
// >> trace-add-categories
addCategories(categories.Navigation);
// << trace-add-categories
setTimeout(function () {
console.log("-----------------------------------------------------");
console.log("New trace category has been added");
console.log("Category: NativeLifecycle");
console.log("-----------------------------------------------------");
alert("NativeLifecycle trace category has been added.");
addCategories(categories.NativeLifecycle);
}, 2000);
write("I (heart) NativeScript!", categories.Debug);
}
开发者ID:aymenbraiek,项目名称:nativescript-sdk-examples-ng,代码行数:28,代码来源:trace-specific-categories-example.component.ts
示例2: onLoadMoreItemsRequested
public onLoadMoreItemsRequested(args: ListViewEventData) {
console.log(`Loading more data`);
this.store.dispatch(this.pokemonActions.loadMore());
// TODO
timerModule.setTimeout(function () {
const listView = args.object;
listView.notifyLoadOnDemandFinished();
}, 1000);
}
示例3: onPullToRefreshInitiated
public onPullToRefreshInitiated(args: ListViewEventData) {
console.log(`ItemComponent - pull to refresh`);
this.store.dispatch(this.pokemonActions.load());
const that = new WeakRef(this);
// TODO
timerModule.setTimeout(function () {
const listView = args.object;
listView.notifyPullToRefreshFinished();
}, 1000);
}
示例4: function
webViewDidFinishLoad: function(webView:UIWebView) {
// The webview fires webViewDidFinishLoad multiple times - I suspect because it's also
// counting iframe loads. So we need to make sure we only set this timer once - then we
// set it to null once it actually fires.
if (!this.changePageTimeout) {
this.changePageTimeout = setTimeout(this.moveToRandomArticleLink.bind(this), 30000);
}
},
示例5: while
(function(j){
timer.setTimeout(() => {
let key = input.items[j].val;
let i = j - 1;
while(i >= 0 && input.items[i].val > key){
input.items[i + 1].val = input.items[i].val;
i = i - 1;
}
input.items[i + 1].val = key;
input.setCurrent(input.items[i + 1]);
},500 * j);
})(j);
示例6: reject
return new Promise<defModule.Location>((resolve, reject) => {
if (!defModule.LocationManager.isEnabled()) {
return reject(new Error("Location service is disabled"));
}
var timer: typeof timerModule = require("timer");
locationManager.startLocationMonitoring(function (location: defModule.Location) {
if (options && ("number" === typeof options.maximumAge)) {
if (location.timestamp.valueOf() + options.maximumAge > new Date().valueOf()) {
locationManager.stopLocationMonitoring();
if ("undefined" !== typeof timerId) {
timer.clearTimeout(timerId);
}
resolve(location);
}
}
else {
locationManager.stopLocationMonitoring();
if ("undefined" !== typeof timerId) {
timer.clearTimeout(timerId);
}
resolve(location);
}
}, function (error: Error) {
console.error('Location error received: ' + error);
locationManager.stopLocationMonitoring();
if ("undefined" !== typeof timerId) {
timer.clearTimeout(timerId);
}
reject(error);
},
options
);
if (options && ("number" === typeof options.timeout)) {
timerId = timer.setTimeout(function () {
locationManager.stopLocationMonitoring();
reject(new Error("timeout searching for location"));
}, options.timeout || defaultGetLocationTimeout);
}
});