當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Q.delay函數代碼示例

本文整理匯總了TypeScript中Q.delay函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript delay函數的具體用法?TypeScript delay怎麽用?TypeScript delay使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了delay函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getFavs

 return getFavs(200, max_id).then((new_max_id) => {
   console.log('new max id is: ' + new_max_id);
   return Q.delay(5000).then(() => {
     console.log('new call');
     return getFavsWithRetries(favs_left - 200, new_max_id - 1);
   })
 })
開發者ID:yesobo,項目名稱:node_twitter_server,代碼行數:7,代碼來源:backup.ts

示例2: spawnReactPackager

    /**
     * Spawns the React Native packager in a child process.
     */
    public spawnReactPackager(args?: string[], options: Options = {}): Q.Promise<ChildProcess> {
        let deferred = Q.defer<ChildProcess>();
        let command = this.getReactCommandName();
        let runArguments = ["start"];

        if (args) {
            runArguments = runArguments.concat(args);
        }

        let spawnOptions = Object.assign({}, { cwd: this.currentWorkingDirectory }, options);

        let result = new Node.ChildProcess().spawn(command, runArguments, spawnOptions);
        result.spawnedProcess.once("error", (error: any) => {
            deferred.reject(ErrorHelper.getNestedError(error, InternalErrorCode.PackagerStartFailed));
        });

        result.stderr.on("data", (data: Buffer) => {
            Log.logMessage(data.toString(), /*formatMessage*/false);
        });

        result.stdout.on("data", (data: Buffer) => {
            Log.logMessage(data.toString(), /*formatMessage*/false);
        });

        // TODO #83 - PROMISE: We need to consume result.outcome here
        Q.delay(300).done(() => deferred.resolve(result.spawnedProcess));
        return deferred.promise;
    }
開發者ID:veeraragavanv,項目名稱:vscode-react-native,代碼行數:31,代碼來源:commandExecutor.ts

示例3: before

 before(function() {
   return Q.delay(500).then(function() {
     return createTransactionPendingApproval();
   })
   .then(function(result) {
     pendingApproval = result;
   });
 });
開發者ID:BitGo,項目名稱:BitGoJS,代碼行數:8,代碼來源:pendingapproval.ts

示例4:

 .then(function(result) {
   result.should.have.property('tx');
   result.should.have.property('hash');
   result.should.have.property('fee');
   return Q.delay(3500)
   .then(function() {
     return testWallet.get();
   });
 })
開發者ID:BitGo,項目名稱:BitGoJS,代碼行數:9,代碼來源:wallets.ts

示例5: require

 jobs.define('failBoat2', (job, cb) =>  {
     var Q = require('q');
     Q.delay(100)
         .then(() => {
             throw(new Error("Zomg fail"));
         })
         .fail(cb)
         .done();
 });
開發者ID:cdbajorin,項目名稱:typed-agenda,代碼行數:9,代碼來源:agenda.ts

示例6: Q

                return Q(result).then(condition).then((conditionResult => {
                    if (conditionResult) {
                        return result;
                    }

                    if (iteration < maxRetries) {
                        return Q.delay(delay).then(() => this.retryAsyncIteration(operation, condition, maxRetries, iteration + 1, delay, failure));
                    }

                    throw new Error(failure);
                }));
開發者ID:KeithLee208,項目名稱:vscode-react-native,代碼行數:11,代碼來源:promise.ts

示例7: function

        return CordovaIosDeviceLauncher.mountDeveloperImage().then(function (): Q.Promise<child_process.ChildProcess> {
            let deferred = Q.defer<child_process.ChildProcess>();
            CordovaIosDeviceLauncher.nativeDebuggerProxyInstance = child_process.spawn('idevicedebugserverproxy', [proxyPort.toString()]);
            CordovaIosDeviceLauncher.nativeDebuggerProxyInstance.on('error', function (err: any): void {
                deferred.reject(err);
            });
            // Allow 200ms for the spawn to error out, ~125ms isn't uncommon for some failures
            Q.delay(200).then(() => deferred.resolve(CordovaIosDeviceLauncher.nativeDebuggerProxyInstance));

            return deferred.promise;
        });
開發者ID:Paradox-Cascade,項目名稱:vscode-cordova,代碼行數:11,代碼來源:cordovaIosDeviceLauncher.ts

示例8: function

        return IosAppRunnerHelper.mountDeveloperImage().then(function(): Q.Promise<child_process.ChildProcess> {
            const deferred = Q.defer<child_process.ChildProcess>();
            SharedState.nativeDebuggerProxyInstance = child_process.spawn("idevicedebugserverproxy", [proxyPort.toString()]);
            SharedState.nativeDebuggerProxyInstance.once("error", function(err: any): void {
                deferred.reject(err);
            });
            // Allow 200ms for the spawn to error out, ~125ms isn't uncommon for some failures
            Q.delay(200).then(() => deferred.resolve(SharedState.nativeDebuggerProxyInstance));

            return deferred.promise;
        });
開發者ID:zhoupan,項目名稱:idevice-app-launcher,代碼行數:11,代碼來源:runApp.ts

示例9:

        return this.mountDeveloperImage().then(function(): Q.Promise<void> {
            const {spawnedProcess} = new Node.ChildProcess().spawnWithExitHandler("idevicedebugserverproxy", [proxyPort.toString()]);
            this.nativeDebuggerProxyInstance = spawnedProcess;
            const deferred = Q.defer<ChildProcess>();

            spawnedProcess.on("error", (err: Error) => {
                deferred.reject(err);
            });

            // Allow 200ms for the spawn to error out
            return Q.delay(200);
        });
開發者ID:veeraragavanv,項目名稱:vscode-react-native,代碼行數:12,代碼來源:deviceRunner.ts

示例10: startWebkitDebugProxy

    public static startWebkitDebugProxy(proxyPort: number, proxyRangeStart: number, proxyRangeEnd: number): Q.Promise<any> {
        if (CordovaIosDeviceLauncher.webDebuggerProxyInstance) {
            CordovaIosDeviceLauncher.webDebuggerProxyInstance.kill();
            CordovaIosDeviceLauncher.webDebuggerProxyInstance = null;
        }

        let deferred = Q.defer();
        let portRange = `null:${proxyPort},:${proxyRangeStart}-${proxyRangeEnd}`;
        CordovaIosDeviceLauncher.webDebuggerProxyInstance = child_process.spawn('ios_webkit_debug_proxy', ['-c', portRange]);
        CordovaIosDeviceLauncher.webDebuggerProxyInstance.on('error', function (err: Error) {
            deferred.reject(new Error('Unable to start ios_webkit_debug_proxy.'));
        });
        // Allow some time for the spawned process to error out
        Q.delay(250).then(() => deferred.resolve({}));

        return deferred.promise;
    }
開發者ID:Paradox-Cascade,項目名稱:vscode-cordova,代碼行數:17,代碼來源:cordovaIosDeviceLauncher.ts


注:本文中的Q.delay函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。