• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript q类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test

        test("should successfully send a message", function(done: MochaDone) {
            const port: string = HostPlatform.getExtensionPipePath();
            let receivedMessage: ExtensionMessage;

            mockServer = net.createServer(function(client: net.Socket): void {
                mockServer.close();
                client.on("data", function(data: Buffer) {
                    const messageData: any = JSON.parse(data.toString("utf8"));
                    client.end();

                    receivedMessage = messageData.message;
                });
            });

            mockServer.on("error", done);
            mockServer.listen(port);

            const sender = new ExtensionMessageSender();

            Q({})
                .then(function() {
                    return sender.sendMessage(ExtensionMessage.START_PACKAGER);
                })
                .then(function() {
                    assert.equal(receivedMessage, ExtensionMessage.START_PACKAGER);
                }).done(() => done(), done);
        });
开发者ID:Mokto,项目名称:vscode-react-native,代码行数:27,代码来源:extensionMessaging.test.ts


示例2: test

        test("should successfully send a message", function(done: MochaDone) {
            let receivedMessage: ExtensionMessage;

            mockServer = net.createServer(function(client: net.Socket): void {
                mockServer.close();
                client.on("data", function(data: Buffer) {
                    const messageData: any = JSON.parse(data.toString("utf8"));
                    client.end();

                    receivedMessage = messageData.message;
                });
            });

            mockServer.on("error", done);
            mockServer.listen(port);

            const sender = RemoteExtension.atProjectRootPath(projectRootPath);

            Q({})
                .then(function() {
                    return sender.startPackager();
                })
                .then(function() {
                    assert.equal(receivedMessage, ExtensionMessage.START_PACKAGER);
                }).done(() => done(), done);
        });
开发者ID:CarlosVV,项目名称:vscode-react-native,代码行数:26,代码来源:extensionMessaging.test.ts


示例3: Q

 .then((model: OntoUmlModel | OntoObjectModel): Q.Promise<OntoObjectModel> => {
     if (frontEnd.returnsOntoObjectModel) {
         return Q(model as OntoObjectModel);
     }
     const objectMapper = new OntoUmlToOntoObjectModelMapper();
     const objectModel = objectMapper.mapToOntoObjectModel(model as OntoUmlModel);
     return Q(objectModel);
 })
开发者ID:CCMi-FIT,项目名称:ontouml-code-generator,代码行数:8,代码来源:app.ts


示例4: basicExecutorFactory

  updateSettings(newSettings: AppSettings): Q.Promise<any> {
    if (this.settingsLocation.readOnly) return Q.reject(new Error('must be writable'));

    this.appSettings = newSettings.attachExecutors((dataCube) => {
      if (dataCube.clusterName === 'native') {
        var fileManager = this.getFileManagerFor(dataCube.source);
        if (fileManager) {
          var dataset = fileManager.dataset;
          if (!dataset) return null;
          return basicExecutorFactory({
            datasets: { main: dataset }
          });
        }

      } else {
        var clusterManager = this.getClusterManagerFor(dataCube.clusterName);
        if (clusterManager) {
          var external = clusterManager.getExternalByName(dataCube.name);
          if (!external) return null;
          return basicExecutorFactory({
            datasets: { main: external }
          });
        }

      }
      return null;
    });

    return Q(null); // ToDo: actually save settings
  }
开发者ID:djfwan,项目名称:pivot,代码行数:30,代码来源:settings-manager.ts


示例5: RangeError

 return TelemetryHelper.generate("launch", (generator) => {
     const resolver = new PlatformResolver();
     const runOptions = this.parseRunOptions();
     const mobilePlatform = resolver.resolveMobilePlatform(runOptions.platform);
     if (!mobilePlatform) {
         throw new RangeError("The target platform could not be read. Did you forget to add it to the launch.json configuration arguments?");
     } else {
         const sourcesStoragePath = path.join(this.projectRootPath, ".vscode", ".react");
         const packager = new Packager(this.projectRootPath, sourcesStoragePath);
         return Q({})
             .then(() => {
                 generator.step("startPackager");
                 return packager.start();
             })
             // We've seen that if we don't prewarm the bundle cache, the app fails on the first attempt to connect to the debugger logic
             // and the user needs to Reload JS manually. We prewarm it to prevent that issue
             .then(() => {
                 generator.step("prewarmBundleCache");
                 return packager.prewarmBundleCache(runOptions.platform);
             })
             .then(() => {
                 generator.step("mobilePlatform.runApp");
                 return mobilePlatform.runApp(runOptions);
             })
             .then(() => {
                 generator.step("Starting App Worker");
                 return new MultipleLifetimesAppWorker(sourcesStoragePath, runOptions.debugAdapterPort).start();
             }) // Start the app worker
             .then(() => {
                 generator.step("mobilePlatform.enableJSDebuggingMode");
                 return mobilePlatform.enableJSDebuggingMode(runOptions);
             }).then(() =>
                 Log.logMessage("Debugging session started succesfuly."));
     }
 });
开发者ID:ajwhite,项目名称:vscode-react-native,代码行数:35,代码来源:launcher.ts


示例6: introspectDataSource

    }).then((ds: string[]) => {
      if (!Array.isArray(ds)) throw new Error('invalid result from data source list');

      var unknownDataSourceNames: string[] = [];
      var nonQueryableDataSources: DataSource[] = [];
      ds.forEach((d: string) => {
        var existingDataSources = myDataSources.filter((dataSource) => {
          return dataSource.engine === 'druid' && dataSource.source === d;
        });

        if (existingDataSources.length === 0) {
          unknownDataSourceNames.push(d);
        } else {
          nonQueryableDataSources = nonQueryableDataSources.concat(existingDataSources.filter((dataSource) => {
            return !dataSource.isQueryable();
          }));
        }
      });

      nonQueryableDataSources = nonQueryableDataSources.concat(unknownDataSourceNames.map((name) => {
        var newDataSource = dataSourceStubFactory(name);
        log(`Adding Druid data source: '${name}'`);
        addOrUpdateDataSource(newDataSource);
        return newDataSource;
      }));

      // Nothing to do
      if (!nonQueryableDataSources.length) return Q(null);

      return Q.allSettled(nonQueryableDataSources.map((dataSource) => {
        return introspectDataSource(dataSource);
      }));
    }).catch((e: Error) => {
开发者ID:fortressll87,项目名称:implydata-pivot,代码行数:33,代码来源:data-source-manager.ts


示例7: Q

 .then((isRunning: boolean) => {
     if (isRunning) {
         /* close the server old instance */
         return Q({})
         .then(()=> simulate.stopSimulate());
     }
 }).then(() => {
开发者ID:fjsnogueira,项目名称:vscode-cordova,代码行数:7,代码来源:simulate.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript qajax类代码示例发布时间:2022-05-28
下一篇:
TypeScript proxyquire类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap