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


TypeScript Q.fcall函数代码示例

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


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

示例1: it

    it('should add a wallet with pre generated keys', function() {

      let userKeychain;

      // Add the user keychain
      const userKeychainPromise = Q.fcall(function() {
        userKeychain = keychains.create();
        return keychains.add(userKeychain);
      }).then(function(keychain) {
        userKeychainId = keychain.id;
      });

      const backupKeychainPromise = Q.fcall(function() {
        return keychains.createBackup();
      })
      .then(function(newBackupKeychain) {
        backupKeychainId = newBackupKeychain.id;
      });

      const bitgoKeychainPromise = keychains.createBitGo()
      .then(function(keychain) {
        bitgoKeychainId = keychain.id;
      });

      // Add the user keychain
      return Q.all([userKeychainPromise, backupKeychainPromise, bitgoKeychainPromise])
      .then(function() {
        const params = {
          label: 'sample wallet',
          m: 2,
          n: 3,
          keys: [userKeychainId, backupKeychainId, bitgoKeychainId],
          isCold: true
        };
        return wallets.add(params);
      }).then(function(res) {
        res.should.have.property('wallet');
        res.wallet.should.have.property('_wallet');
        res.wallet._wallet.should.have.property('keys');
        res.wallet._wallet.keys[0].should.equal(userKeychainId);
        res.wallet._wallet.keys[1].should.equal(backupKeychainId);
        res.wallet._wallet.keys[2].should.equal(bitgoKeychainId);
        return res.wallet.remove();
      })
      .then(function(removal) {
        removal.deleted.should.equal(true);
      });
    });
开发者ID:BitGo,项目名称:BitGoJS,代码行数:48,代码来源:wallets.ts

示例2: it

 it('Q indirect resolve', (done) => {
   Q.fcall(() => {
     return 1;
   }).then((x) => {
     assert.equal(x, 1, 'one');
   }).then(done, done).done();
 }),
开发者ID:relution-io,项目名称:relution-sdk,代码行数:7,代码来源:q.spec.ts

示例3: setupEnv

 /**
  * Configure and launch (if applicable) the object's environment.
  * @public
  * @return {q.promise} A promise which will resolve when the environment is
  *     ready to test.
  */
 setupEnv(): q.Promise<any> {
   switch (this.config_.capabilities.browserName) {
     case 'chrome':
       logger.info('Using ChromeDriver directly...');
       break;
     case 'firefox':
       logger.info('Using FirefoxDriver directly...');
       break;
     default:
       throw new BrowserError(
           logger, 'browserName ' + this.config_.capabilities.browserName +
               ' is not supported with directConnect.');
   }
   return q.fcall(function() {});
 }
开发者ID:AleNoemi,项目名称:protractor,代码行数:21,代码来源:direct.ts

示例4: constructor

  constructor(settingsLocation: SettingsLocation, options: SettingsManagerOptions) {
    var logger = options.logger;
    this.logger = logger;
    this.verbose = Boolean(options.verbose);
    this.anchorPath = options.anchorPath;

    this.settingsLocation = settingsLocation;
    this.fileManagers = [];
    this.clusterManagers = [];

    this.initialLoadTimeout = options.initialLoadTimeout || 30000;
    this.appSettings = AppSettings.BLANK;

    switch (settingsLocation.location) {
      case 'transient':
        this.currentWork = Q(null)
          .then(() => {
            return settingsLocation.initAppSettings ? this.reviseSettings(settingsLocation.initAppSettings) : null;
          })
          .catch(e => {
            logger.error(`Fatal settings initialization error: ${e.message}`);
            throw e;
          });
        break;

      case 'local':
        this.currentWork = Q.fcall(() => {
          var appSettingsJS = loadFileSync(settingsLocation.uri, 'yaml');
          appSettingsJS = inlineVars(appSettingsJS, process.env);
          return AppSettings.fromJS(appSettingsJS, { visualizations: MANIFESTS });
        })
          .then((appSettings) => {
            return this.reviseSettings(appSettings);
          })
          .catch(e => {
            logger.error(`Fatal settings load error: ${e.message}`);
            throw e;
          });

        break;

      default:
        throw new Error(`unknown location ${settingsLocation.location}`);
    }

    this.makeMaxTimeCheckTimer();
  }
开发者ID:djfwan,项目名称:pivot,代码行数:47,代码来源:settings-manager.ts

示例5: requester

      function requester({query}) {
        return Q.fcall(() => {
          if (query.queryType === 'status') return { version: '0.8.3' };
          if (query.queryType !== 'segmentMetadata') throw new Error(`what is ${query.queryType}`);
          run++;

          if (run > 1) {
            columns.channel = {
              "type": "STRING",
              "hasMultipleValues": false,
              "size": 0,
              "cardinality": 0,
              "errorMessage": null
            };
          }

          return [{ columns }];
        });
      }
开发者ID:Rahul-Sindhu,项目名称:pivot,代码行数:19,代码来源:data-source.mocha.ts

示例6: updateJob

 /**
  * Default update job method.
  * @return a promise
  */
 updateJob(update: any): q.Promise<any> {
   return q.fcall(function() {});
 };
开发者ID:DylanLacey,项目名称:protractor,代码行数:7,代码来源:driverProvider.ts

示例7: setupEnv

 /**
  * Default setup environment method.
  * @return a promise
  */
 setupEnv(): q.Promise<any> {
   return q.fcall(function() {});
 };
开发者ID:MexicanAce,项目名称:protractor,代码行数:7,代码来源:driverProvider.ts

示例8: setupEnv

 /**
  * Configure and launch (if applicable) the object's environment.
  * @public
  * @return {q.promise} A promise which will resolve when the environment is
  *     ready to test.
  */
 setupEnv(): q.Promise<any> {
   logger.info('Using the selenium server at ' + this.config_.seleniumAddress);
   return q.fcall(function() {});
 }
开发者ID:AkshayNaik033,项目名称:protractor,代码行数:10,代码来源:hosted.ts

示例9: createMySQLGateway

  createMySQLGateway(port, (parameters: MySQLParameters, conn: any): void => {
    var { sql, connectionId } = parameters;
    Q.fcall(() => {
      var myContext = context;
      var match: string[];

      // Deal with "SELECT @@blah LIMIT 1" by de-sugaring
      if ((/SELECT\s+@@/i).test(sql)) {
        sql = sql.replace(/@@(?:global\.|session\.)?/g, '');
        myContext = {
          data: getVariablesFlatDataset()
        }
      }

      // Hack, treat USE `blah` as SET ... (ignores it)
      if (match = sql.match(/USE\s+`/i)) {
        sql = "SET NAMES 'utf8'";
      }

      // Handle connection id query
      if (match = sql.match(/SELECT\s+(CONNECTION_ID\(\s*\))/i)) {
        return {
          type: 'connectionId',
          name: match[1]
        }
      }

      try {
        var sqlParse = Expression.parseSQL(sql);
      } catch (e) {
        printError(sql, e);
        return {
          type: 'error',
          code: 1064, // You have an error in your SQL syntax
          message: e.message
        };
      }

      if (!sqlParse.verb) {
        return {
          type: 'error',
          code: 1064,
          message: `Must have a verb`
        };
      }

      switch (sqlParse.verb) {
        case 'SET':
          return {
            type: 'ok'
          };

        case 'SELECT':
          return executeSQLParse(sqlParse, myContext, timezone)
            .then((dataset: PlywoodValue): MySQLResult => {
              if (Dataset.isDataset(dataset)) {
                return {
                  type: 'dataset',
                  dataset,
                  table: sqlParse.table
                };
              } else {
                throw new Error('unexpected result from expression');
              }
            });

        default:
          return {
            type: 'error',
            code: 1337,
            message: `Permission to ${sqlParse.verb} denied`
          };
      }
    })
    .then((result: MySQLResult): any => {
      switch (result.type) {
        case 'ok':
          conn.writeOk();
          break;

        case 'error':
          conn.writeError({ code: result.code, message: result.message });
          break;

        case 'dataset':
          var dataset = result.dataset;
          var plyColumns = dataset.getColumns().map(c => columnToMySQL(c, result.table));
          var plyRows = dataset.flatten().map(row => {
            var newRow: any = {};
            for (var k in row) {
              var v = row[k];

              // Kill ranges
              if (v && v.start) v = v.start;

              if (v && v.toISOString) {
                v = dateToSQL(v);
              } else if (Set.isSet(v)) {
                v = v.toString();
              } else if (typeof v === 'boolean') {
//.........这里部分代码省略.........
开发者ID:baeeq,项目名称:plyql,代码行数:101,代码来源:plyql-mysql-gateway.ts

示例10: setupDriverEnv

 /**
  * Configure and launch (if applicable) the object's environment.
  * @public
  * @return {q.promise} A promise which will resolve immediately.
  */
 protected setupDriverEnv(): q.Promise<any> {
   return q.fcall(function() {});
 }
开发者ID:DylanLacey,项目名称:protractor,代码行数:8,代码来源:mock.ts


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