当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript timer.setTimeout函数代码示例

本文整理汇总了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);
 }
开发者ID:xmlking,项目名称:WearableHub,代码行数:9,代码来源:pokemon-list-pro.component.ts

示例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);
 }
开发者ID:xmlking,项目名称:WearableHub,代码行数:10,代码来源:pokemon-list-pro.component.ts

示例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);
     }
 },
开发者ID:burkeholland,项目名称:nativescript-webview-experiment,代码行数:10,代码来源:detector-controller.ts

示例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);
开发者ID:thelgevold,项目名称:native-script-poc,代码行数:13,代码来源:insertion-sort.service.ts

示例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);
        }
    });
开发者ID:329379172,项目名称:NativeScript,代码行数:42,代码来源:location-common.ts


注:本文中的timer.setTimeout函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。