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


TypeScript file-url.default函数代码示例

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


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

示例1: createTweetMessage

	ipcRenderer.on('itunes-get-track-reply', (event, arg) => {
		nowPlayingTrack = arg as NowPlayingTrack
		console.log('get track success')
		console.log(nowPlayingTrack)
		trackNameElement.innerHTML = createTweetMessage(nowPlayingTrack)
		artworkImageElement.style.backgroundImage = `url(${fileUrl(nowPlayingTrack.artworkPath)})`
	})
开发者ID:castaneai,项目名称:nowpl,代码行数:7,代码来源:index.ts

示例2: CreateFileOrFolderUri

export function CreateFileOrFolderUri(absolutePath: string): string {
  if (!isAbsolute(absolutePath)) {
    throw new Error(`Can only create file URIs from absolute paths. Got '${absolutePath}'`);
  }
  let result = fileUri(absolutePath, { resolve: false });
  // handle UNCs
  if (absolutePath.startsWith("//") || absolutePath.startsWith("\\\\")) {
    result = result.replace(/^file:\/\/\/\//, "file://");
  }
  return result;
}
开发者ID:indrajithbandara,项目名称:autorest,代码行数:11,代码来源:uri.ts

示例3: grammarFromSource

async function grammarFromSource(rngSource: string | Grammar):
Promise<Grammar> {
  if (rngSource instanceof Grammar) {
    return rngSource;
  }

  const rngSourceContent = fs.readFileSync(path.resolve(rngSource),
                                           "utf8").toString();
  // We try loading the tree as a JSON file. It may not work if the file is not
  // actually JSON.
  let obj: {} | undefined;
  try {
    obj = JSON.parse(rngSourceContent);
  }
  // tslint:disable-next-line:no-empty
  catch {}

  if (obj !== undefined) {
    return readTreeFromJSON(obj);
  }

  // Treat it as a Relax NG schema.
  return (await convertRNGToPattern(new URL(fileUrl(rngSource)))).pattern;
}
开发者ID:lddubeau,项目名称:salve,代码行数:24,代码来源:parse.ts

示例4: CreateFileOrFolderUri

export function CreateFileOrFolderUri(absolutePath: string): string {
  if (!isAbsolute(absolutePath)) {
    throw new Error("Can only create file URIs from absolute paths.");
  }
  return fileUri(absolutePath, { resolve: false });
}
开发者ID:jianghaolu,项目名称:AutoRest,代码行数:6,代码来源:uri.ts

示例5: start

async function start(): Promise<void> {
  let startTime: number | undefined;
  if (args.simplified_input) {
    return convert({
      simplified: parseSimplifiedSchema(
        args.input_path,
        fs.readFileSync(args.input_path).toString()),
      warnings: [],
      manifest: [],
    });
  }

  const resourceLoader = makeResourceLoader();

  let simplified: Element | undefined;
  let warnings: string[] | undefined;
  if (args.validator !== "none") {
    if (args.verbose) {
      console.log("Validating RNG...");
      if (args.timing) {
        startTime = Date.now();
      }
    }

    const validator = makeValidator(args.validator, {
      verbose: args.verbose,
      timing: args.timing,
      resourceLoader,
      keepTemp: args.keep_temp,
      simplifyTo: args.simplify_to,
      ensureTempDir,
      validate: true,
      createManifest: false,
      manifestHashAlgorithm: "void",
    });

    ({ simplified, warnings } =
     await validator.validate(new URL(fileUrl(args.input_path))));

    if (args.timing) {
      console.log(`Validation delta: ${Date.now() - startTime!}`);
    }
  }

  if (simplified !== undefined) {
    return convert({
      simplified,
      warnings: warnings === undefined ? [] : warnings,
      manifest: [],
    });
  }

  const simplifier = makeSimplifier(args.simplifier, {
    verbose: args.verbose,
    timing: args.timing,
    keepTemp: args.keep_temp,
    simplifyTo: args.simplify_to,
    ensureTempDir,
    resourceLoader,
    validate: false,
    createManifest: false,
    manifestHashAlgorithm: "void",
  });

  return simplifier.simplify(new URL(fileUrl(args.input_path))).then(convert);
}
开发者ID:lddubeau,项目名称:salve,代码行数:66,代码来源:convert.ts


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