• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript merge-options.default函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: beforeEach

 beforeEach(async () => {
   // We modify the default to have test-mode do its default behavior
   // which is to hide *some* attributes.
   const localOptions: Options = mergeOptions({}, options);
   localOptions.mode.submode!.mode.options!.hide_attributes = false;
   tree = new ModeTree(editor, localOptions.mode);
   await tree.init();
 });
开发者ID:lddubeau,项目名称:wed,代码行数:8,代码来源:mode-tree-test.ts


示例2: mergeOptions

export const middleware: INeutrinoMiddleware<IPresetOptions> = (
	neutrino,
	opts = {},
) => {
	const options: IPresetOptions = mergeOptions(defaultOptions, opts);

	if (
		options.react &&
		options.react.style &&
		typeof options.react.style === "object"
	) {
		const { sass, postcss, ...styleOptions } = options.react.style;

		neutrino.use(styleLoader, {
			// Override the default file extension of `.css` if needed
			test: neutrino.regexFromExtensions(["css"]),
			modulesTest: neutrino.regexFromExtensions(["sass", "scss"]),
			loaders: [
				// Define loaders as objects
				{
					loader: "sass-loader",
					useId: "sass",
					options: sass,
				},
				{
					loader: "postcss-loader",
					options: postcss,
				},
			],
			...styleOptions,
		});
	}

	neutrino.use(react, { ...options.react, style: false });

	if (!options.experimentalBabelTypescript) {
		fallbackToTsLoader(neutrino);
	}

	if (options.jest) {
		neutrino.use(jest, options.jest !== true ? options.jest : undefined);
	}

	if (options.pwa) {
		neutrino.use(pwa, options.pwa !== true ? options.pwa : undefined);
	}

	if (options.node) {
		neutrino.config.node.merge(options.node);
	}

	neutrino.config
		.plugin("fork-ts-checker")
		.use(forkTsChecker, [options.forkTsChecker]);

	neutrino.config.output.set("publicPath", "/");
};
开发者ID:cubos,项目名称:neutrino-preset-web,代码行数:57,代码来源:index.ts


示例3: attributeHidingSpecs

  get attributeHidingSpecs(): AttributeHidingSpecs | null {
    if (this._attributeHidingSpecs === undefined) {
      const attributeHiding = this.wedOptions.attributes.autohide;
      if (attributeHiding === undefined) {
        // No attribute hiding...
        this._attributeHidingSpecs = null;
      }
      else {
        const method = attributeHiding.method;
        if (method !== "selector") {
          throw new Error(`unknown attribute hiding method: ${method}`);
        }

        const specs: AttributeHidingSpecs = {
          elements: [],
        };

        for (const element of attributeHiding.elements) {
          const copy = mergeOptions({}, element);
          copy.selector =
            toGUISelector(copy.selector,
                          this.mode.getAbsoluteNamespaceMappings());
          specs.elements.push(copy);
        }

        this._attributeHidingSpecs = specs;
      }
    }

    return this._attributeHidingSpecs;
  }
开发者ID:lddubeau,项目名称:wed,代码行数:31,代码来源:mode-tree.ts


示例4: constructor

 constructor(editor: EditorAPI, options: TestModeOptions) {
   super(editor, options);
   this.wedOptions = mergeOptions({}, this.wedOptions);
   // Oh god, that as "hide" bit is funny as hell. Anyway we need it to
   // purposely put a crap value there.
   this.wedOptions.attributes = "moo" as "hide";
 }
开发者ID:lddubeau,项目名称:wed,代码行数:7,代码来源:bad-wed-options.ts


示例5: constructor

  constructor(options: Options) {
    // Make a deep copy.
    options = mergeOptions({}, options);
    this.options = options;
    const bluejaxOptions = options.bluejaxOptions != null ?
      options.bluejaxOptions : {
      tries: 3,
      delay: 100,
      diagnose: {
        on: true,
        // It would be desirable to support this...
        // serverURL: "/ping",
        knownServers: [
          // tslint:disable:no-http-string
          "http://www.google.com/",
          "http://www.cloudfront.com/",
          // tslint:enable:no-http-string
        ],
      },
    };
    const made = ajax(bluejaxOptions);

    this.ajax = made.ajax;
    this.ajax$ = made.ajax$;
  }
开发者ID:lddubeau,项目名称:wed,代码行数:25,代码来源:runtime.ts


示例6: expectError

    it("rejects if there are any wedOptions errors", async () => {
      const newOptions = mergeOptions({}, options.mode);
      const path = "tests/modes/failing-init";
      newOptions.path = path;

      const tree = new ModeTree(editor, newOptions);
      await expectError(() => tree.init(), Error, /^failed init$/);
    });
开发者ID:lddubeau,项目名称:wed,代码行数:8,代码来源:mode-tree-test.ts


示例7: before

 before(() => {
   setup = new EditorSetup(
     "/base/build/standalone/lib/tests/wed_test_data/source_converted.xml",
     mergeOptions(globalConfig.config, options),
     document);
   ({ editor } = setup);
   return setup.init();
 });
开发者ID:lddubeau,项目名称:wed,代码行数:8,代码来源:mode-tree-test.ts


示例8: before

 before(() => {
   setup = new EditorSetup(
     "/base/build/standalone/lib/tests/wed_test_data/source_converted.xml",
     mergeOptions(globalConfig.config, options),
     document);
   ({ editor } = setup);
   return setup.init().then(() => {
     // tslint:disable-next-line:no-any
     (editor.validator as any)._validateUpTo(editor.dataRoot, -1);
   });
 });
开发者ID:lddubeau,项目名称:wed,代码行数:11,代码来源:wed-hide-attributes-test.ts


示例9: beforeEach

  beforeEach(() => {
    setup = new EditorSetup(
      "/base/build/standalone/lib/tests/input_trigger_test_data/\
source_converted.xml",
      mergeOptions(globalConfig.config, options),
      document);
    ({ editor } = setup);
    return setup.init().then(() => {
      mode = editor.modeTree.getMode(editor.guiRoot);
      pInBody = editor.dataRoot.querySelector("body p")!;
    });
  });
开发者ID:lddubeau,项目名称:wed,代码行数:12,代码来源:input-trigger-test.ts


示例10: _post

  /**
   * Utility wrapper for Ajax queries. Read the code for more information.
   *
   * @private
   *
   * @param data
   * @param dataType
   *
   * @returns A promise that resolves when the post is over.
   */
  private _post(data: Message, dataType: string): Promise<Response> {
    let headers;

    if (this.etag !== undefined) {
      headers = mergeOptions(this.headers, {
        "If-Match": this.etag,
      });
    }
    else {
      headers = this.headers;
    }

    return this.runtime.ajax({
      type: "POST",
      url: this.url,
      data: data,
      dataType: dataType,
      headers: headers,
      bluejaxOptions: {
        verboseResults: true,
      },
    }).then(([reply, , jqXHR]) => {
      const msgs = getMessages(reply);
      // Unsuccessful operations don't have a valid etag.
      if (msgs !== undefined && msgs.save_successful !== undefined) {
        this.etag = jqXHR.getResponseHeader("ETag");
      }

      return reply;
      // tslint:disable-next-line:no-any
    }).catch((bluejaxError: any) => {
      const jqXHR = bluejaxError.jqXHR;
      // This is a case where a precondition failed.
      if (jqXHR.status === 412) {
        // We transform the 412 status into a Response object that will
        // produce the right reaction.
        return {
          messages: [{
            msg: "The document was edited by someone else.",
            type: "save_edited",
          }],
        };
      }
      throw bluejaxError;
    });
  }
开发者ID:lddubeau,项目名称:wed,代码行数:56,代码来源:ajax.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript merge-stream.default函数代码示例发布时间:2022-05-25
下一篇:
TypeScript merge.default函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap