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


TypeScript Client.end方法代码示例

本文整理汇总了TypeScript中fb-watchman.Client.end方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Client.end方法的具体用法?TypeScript Client.end怎么用?TypeScript Client.end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fb-watchman.Client的用法示例。


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

示例1: watchmanCrawl


//.........这里部分代码省略.........

          const response = await cmd('query', root, query);

          if ('warning' in response) {
            console.warn('watchman warning: ', response.warning);
          }

          isFresh = isFresh || response.is_fresh_instance;
          files.set(root, response);
        },
      ),
    );

    return {
      files,
      isFresh,
    };
  }

  let files = data.files;
  let watchmanFiles: Map<string, any>;
  try {
    const watchmanRoots = await getWatchmanRoots(roots);
    const watchmanFileResults = await queryWatchmanForDirs(watchmanRoots);

    // Reset the file map if watchman was restarted and sends us a list of
    // files.
    if (watchmanFileResults.isFresh) {
      files = new Map();
    }

    watchmanFiles = watchmanFileResults.files;
  } finally {
    client.end();
  }

  if (clientError) {
    throw clientError;
  }

  // TODO: remove non-null
  for (const [watchRoot, response] of watchmanFiles!) {
    const fsRoot = normalizePathSep(watchRoot);
    const relativeFsRoot = fastPath.relative(rootDir, fsRoot);
    clocks.set(relativeFsRoot, response.clock);

    for (const fileData of response.files) {
      const filePath = fsRoot + path.sep + normalizePathSep(fileData.name);
      const relativeFilePath = fastPath.relative(rootDir, filePath);

      if (!fileData.exists) {
        files.delete(relativeFilePath);
      } else if (!ignore(filePath)) {
        const mtime =
          typeof fileData.mtime_ms === 'number'
            ? fileData.mtime_ms
            : fileData.mtime_ms.toNumber();
        const size = fileData.size;

        let sha1hex = fileData['content.sha1hex'];
        if (typeof sha1hex !== 'string' || sha1hex.length !== 40) {
          sha1hex = null;
        }

        const existingFileData = data.files.get(relativeFilePath);
        let nextData: FileMetaData;
开发者ID:elliottsj,项目名称:jest,代码行数:67,代码来源:watchman.ts

示例2:

client.capabilityCheck({ optional: [], required: ['relative_root'] }, e => {
	if (e) {
	  client.end();
	  return;
	}
});
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:6,代码来源:fb-watchman-tests.ts


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