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


TypeScript timer.clearTimeout函数代码示例

本文整理汇总了TypeScript中timer.clearTimeout函数的典型用法代码示例。如果您正苦于以下问题:TypeScript clearTimeout函数的具体用法?TypeScript clearTimeout怎么用?TypeScript clearTimeout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了clearTimeout函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

 moveToRandomArticleLink: function() {
     // Reset our timeout so it'll run again on next load
     clearTimeout(this.changePageTimeout);
     this.changePageTimeout = null;
     let allLinksResponse = this.webview.stringByEvaluatingJavaScriptFromString(`
         window.onerror = function(err) {alert(err)};
         (function() {
             var allArticleLinks = document.querySelectorAll('a[href^="/2016"]');
             
             return JSON.stringify(Array.prototype.slice.call(allArticleLinks).map(function(a) {
                 return a.href;
             }));
             
         })();
     `);
     let parsedAllLinks = JSON.parse(allLinksResponse);
     
     // Some pages don't have any links on them, so we keep a cache of all the article links
     // we find, then select from them.
     
     for (let link of parsedAllLinks) {
         if (this.availableLinks.indexOf(link) === -1) {
             this.availableLinks.push(link);
         }
     }
     
     let indexToSelect = Math.floor(Math.random() * this.availableLinks.length);
     
     let [removedLink] = this.availableLinks.splice(indexToSelect, 1);
     
     console.log("Sending to", removedLink);
     this.webview.stringByEvaluatingJavaScriptFromString(`window.location = '${removedLink}'`);
 },
开发者ID:alastaircoote,项目名称:nativescript-webview-experiment,代码行数:33,代码来源:detector-controller.ts

示例2: function

 }, function (error: Error) {
         console.error('Location error received: ' + error);
         locationManager.stopLocationMonitoring();
         if ("undefined" !== typeof timerId) {
             timer.clearTimeout(timerId);
         }
         reject(error);
     },
开发者ID:329379172,项目名称:NativeScript,代码行数:8,代码来源:location-common.ts

示例3: resolve

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

示例4: function

 moveToRandomArticleLink: function() {
     // Reset our timeout so it'll run again on next load
     clearTimeout(this.changePageTimeout);
     this.changePageTimeout = null;
     
     this.webview.stringByEvaluatingJavaScriptFromString(`
         (function() {
             var allArticleLinks = document.querySelectorAll('a[href^="/2016"]');
             var selectedLink = allArticleLinks[Math.floor(Math.random() * allArticleLinks.length)];
             window.location = selectedLink.href;
         })();
     `)
 },
开发者ID:burkeholland,项目名称:nativescript-webview-experiment,代码行数:13,代码来源:detector-controller.ts


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