當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。