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


TypeScript merge.default函数代码示例

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


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

示例1: _registerTheme

  /** Registers a theme in the $mdTheming provider */
  private _registerTheme(theme: MdTheme) {
    // Apply defaults theme palettes to current theme.
    theme = merge({}, DefaultConfig.theme, theme);

    let themeRef = this._$mdThemingProvider
      .theme(theme.name || 'default')
      .primaryPalette(theme.primaryPalette, theme.primaryPaletteHues)
      .accentPalette(theme.accentPalette, theme.accentPaletteHues)
      .warnPalette(theme.warnPalette, theme.warnPaletteHues)
      .backgroundPalette(theme.backgroundPalette, theme.backgroundPaletteHues);

    if (theme.dark) {
      themeRef.dark();
    }
  }
开发者ID:angular,项目名称:material-tools,代码行数:16,代码来源:ThemeBuilder.ts

示例2: serve

export function serve(options: ScaleOptions, app?: () => void): void {
  var i, startTimes = {}, failures = 0;
  options = merge({
    cores: defaultCores,
    retryThreshold: 23,
    retryDelay: 10000,
    failureThreshold: 5000
  }, options);

  function pid(worker) {
    return options.worker ? worker.pid : worker.process.pid;
  }

  function spawnMore() {
    var worker;
    if (options.worker) {
      worker = child.fork(options.worker, options.workerArgs);
      log.debug("Spawning worker %s as child process: %j %j",
                pid(worker), options.worker, options.workerArgs);
    } else {
      worker = cluster.fork();
      log.debug("Spawning worker in cluster:", pid(worker));
    }

    startTimes[pid(worker)] = Date.now();
    if (!options.worker) {
      worker.on("listening", (addr) =>
                log.info("Process", pid(worker), "is now listening on",
                         addr.address + ":" + addr.port));
    }

    // Enable Erlang mode
    worker.on("exit", (code, signal) => {
      var replacement, lifetime = Date.now() - startTimes[pid(worker)];
      delete startTimes[pid(worker)];

      if (worker.suicide) {
        log.info("Worker", pid(worker), "terminated voluntarily.");
        return;
      }

      log.info("Process", pid(worker), "terminated with signal", signal,
                  "code", code + "; restarting.");

      if (lifetime < options.failureThreshold) {
        failures++;
      } else {
        failures = 0;
      }

      if (failures > options.retryThreshold) {
        log.warn(failures + " consecutive failures; pausing for",
                 options.retryDelay + "ms before respawning.");
      }

      setTimeout(() => {
        replacement = spawnMore();
        replacement.on("online", () =>
                       log.info("Process", replacement.process.pid,
                                "has successfully replaced", pid(worker)));
      }, (failures > options.retryThreshold) ? options.retryDelay : 0);
    });

    return worker;
  }

  if (cluster.isMaster) {
    // Spawn more overlords
    for (i = 0; i < options.cores; i++) {
      spawnMore();
    }

    log.info("Spawned", options.cores, options.worker ? "worker processes."
             : "server instances.");
  } else {
    log.handleExceptions();
    options.worker || app();
  }
}
开发者ID:FutureAdLabs,项目名称:hellojoe,代码行数:79,代码来源:hellojoe.ts

示例3: appendJSConfig

export function appendJSConfig(data): boolean {
    if (!workspace || !workspace.rootPath) {
        return false;
    }

    let jscPath = path.join(workspace.rootPath, "jsconfig.json");
    let newJsc;
    let mergedJsc;
    let currentJsc;

    // Check first if a jsconfig.json exists
    if (pathExists.sync(jscPath)) {
        // Merge
        try {
            currentJsc = JSON.parse(fs.readFileSync(jscPath, "utf8"));
            mergedJsc = merge(currentJsc, data);
        } catch (e) {
            console.log(e);
        }
    }

    // Write new config
    try {
        newJsc = mergedJsc || jsConfig;
        fs.writeFileSync(jscPath, JSON.stringify(newJsc), "utf8");
    } catch (e) {
        return false;
    }
}
开发者ID:ChrisBriggsy,项目名称:vsc-ember-cli,代码行数:29,代码来源:file-ops.ts

示例4: addDefaults

function addDefaults(option: any): any {
  return merge({
    type: 'string',
    requiresArg: true,
    group: MAIN_GROUP,
    global: true
  }, option);
}
开发者ID:angular,项目名称:material-tools,代码行数:8,代码来源:options.ts

示例5: writeSetting

export function writeSetting(data) {
    let currentConfig, mergedConfig, newConfig;
    // Check first if a jsconfig.json exists
    if (pathExists.sync(configPath)) {
        // Merge
        try {
            currentConfig = JSON.parse(fs.readFileSync(configPath, "utf8"));
            mergedConfig = merge(currentConfig, data);
        } catch (e) {
            console.log(e);
        }
    }

    // Write new config
    try {
        newConfig = mergedConfig || data;
        fs.writeFileSync(configPath, JSON.stringify(newConfig), "utf8");
        return true;
    } catch (e) {
        return false;
    }
}
开发者ID:Georotzen,项目名称:vsc-ember-cli,代码行数:22,代码来源:config.ts

示例6: function

 passport.use( new passportGithub.Strategy(passportOptions, function(accessToken, refreshToken, profile, done) {
     done(null, merge(profile._json, { token: accessToken }));
 }));
开发者ID:thojansen,项目名称:github-seed,代码行数:3,代码来源:githubAuthentication.ts

示例7: it

  it('should reject for an invalid file path', done => {
    let versionDataCopy = merge({}, versionData, { module: './some/random/path/' });

    LocalResolver.resolve(components, versionDataCopy)
      .then(() => done.fail(), done);
  });
开发者ID:angular,项目名称:material-tools,代码行数:6,代码来源:LocalResolver.spec.ts


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