当前位置: 首页>>代码示例>>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;未经允许,请勿转载。