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


TypeScript merge-options.default函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。