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


TypeScript smartq.defer函數代碼示例

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


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

示例1:

export let run = (configArg: INpmtsConfig) => {
  let done = q.defer();
  let shipString =
    '' +
    '\n' +
    '\n' +
    '                                         # #  ( )\n' +
    '                                      ___#_#___|__\n' +
    '                                  _  |____________|  _\n' +
    '                           _=====| | |            | | |==== _\n' +
    '                     =====| |.---------------------------. | |====\n' +
    "       <--------------------'   .  .  .  .  .  .  .  .   '--------------/\n" +
    '         \\                                                             /\n' +
    '          \\___________________________________________________________/\n' +
    '    wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
    '   wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
    '     wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n';
  if (process.env.CI) {
    console.log(shipString);
    plugins.beautylog.success('READY TO SHIP!');
  } else {
    plugins.beautylog.success('Done!');
  }
  done.resolve(configArg);
};
開發者ID:pushrocks,項目名稱:npmts,代碼行數:25,代碼來源:npmts.ship.ts

示例2: function

export let run = function(configArg: INpmtsConfig) {
  let done = q.defer<INpmtsConfig>();
  let config = configArg;
  if (config.test === true) {
    plugins.beautylog.ora.text('now starting tests');
    plugins.beautylog.ora.end();
    plugins.beautylog.log('ready for tapbuffer:');
    if (configArg.testConfig.coverage) {
      tap(config)
        .then(handleCoverageData)
        .then(() => {
          done.resolve(config);
        })
        .catch(err => {
          console.log(err);
        });
    } else {
      tap(config)
        .then(() => {
          done.resolve(config);
        })
        .catch(err => {
          console.log(err);
        });
    }
  } else {
    plugins.beautylog.ora.end();
    done.resolve(config);
  }
  return done.promise;
};
開發者ID:pushrocks,項目名稱:npmts,代碼行數:31,代碼來源:index.ts

示例3:

export let run = (configArg: INpmtsConfig) => {
  let done = q.defer();
  if (configArg.watch && npmtsSmartchok === null) {
    let pathsToWatch: string[] = [];
    for (let key in configArg.ts) {
      pathsToWatch.push(key);
    }
    for (let key in configArg.testTs) {
      pathsToWatch.push(key);
    }
    npmtsSmartchok = new smartchok.Smartchok(pathsToWatch);
    npmtsSmartchok.getObservableFor('change').then(changeObservableArg => {
      plugins.beautylog.info('now watching...');
      changeObservableArg.subscribe(() => {
        cli.run();
      });
    });
    npmtsSmartchok.start();
    done.resolve(configArg);
  } else {
    plugins.beautylog.info('not watching');
    done.resolve(configArg);
  }
  return done.promise;
};
開發者ID:pushrocks,項目名稱:npmts,代碼行數:25,代碼來源:npmts.watch.ts

示例4: ProjectinfoNpm

let checkProjectTypings = (configArg: INpmtsConfig) => {
  let done = q.defer<INpmtsConfig>();
  plugins.beautylog.ora.text('Check Module: Check Project Typings...');
  projectInfo = new ProjectinfoNpm(paths.cwd);
  if (typeof projectInfo.packageJson.typings === 'undefined') {
    plugins.beautylog.error(`please add typings field to package.json`);
    process.exit(1);
  }
  done.resolve(configArg);
  return done.promise;
};
開發者ID:pushrocks,項目名稱:npmts,代碼行數:11,代碼來源:mod.check.ts

示例5: function

export let run = function(configArg) {
  plugins.beautylog.ora.text('cleaning up from previous builds...');
  let done = q.defer();
  removeDist()
    .then(removePages)
    .then(function() {
      plugins.beautylog.ok('Cleaned up from previous builds!');
      done.resolve(configArg);
    });
  return done.promise;
};
開發者ID:pushrocks,項目名稱:npmts,代碼行數:11,代碼來源:mod.clean.ts

示例6:

 .then(configArg => {
   let done = q.defer<NpmtsConfig.INpmtsConfig>();
   NpmtsMods.modTest
     .load()
     .then(modTest => {
       return modTest.run(configArg);
     })
     .then(configArg => {
       done.resolve(configArg);
     });
   return done.promise;
 })
開發者ID:pushrocks,項目名稱:npmts,代碼行數:12,代碼來源:npmts.cli.ts

示例7: function

export let run = function(configArg) {
  let done = q.defer();
  let config = configArg;
  plugins.beautylog.ora.text('now compiling ' + 'TypeScript');
  plugins.tsn
    .compileGlobStringObject(config.ts, config.tsOptions, paths.cwd)
    .then(() => {
      plugins.beautylog.ok(`compiled the module's TypeScript!`);
      done.resolve(config);
    })
    .catch(err => {
      console.log(err);
    });
  return done.promise;
};
開發者ID:pushrocks,項目名稱:npmts,代碼行數:15,代碼來源:mod.compile.ts

示例8: function

export let run = function(configArg) {
  let done = q.defer();
  let config = configArg;
  plugins.beautylog.ora.text('now looking at ' + 'required assets');
  if (config.cli === true) {
    let mainJsPath = projectInfo.packageJson.main;
    let cliJsString: string = plugins.smartfile.fs.toStringSync(
      plugins.path.join(paths.npmtsAssetsDir, 'cli.js')
    );
    cliJsString = cliJsString.replace('{{pathToIndex}}', mainJsPath);
    plugins.smartfile.memory.toFsSync(cliJsString, plugins.path.join(paths.distDir, 'cli.js'));
    plugins.beautylog.ok('installed CLI assets!');
    done.resolve(config);
  } else {
    plugins.beautylog.ok('No additional assets required!');
    done.resolve(config);
  }
  return done.promise;
};
開發者ID:pushrocks,項目名稱:npmts,代碼行數:19,代碼來源:mod.assets.ts


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