本文整理汇总了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();
});
示例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", "/");
};
示例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;
}
示例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";
}
示例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$;
}
示例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$/);
});
示例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();
});
示例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);
});
});
示例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")!;
});
});
示例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;
});
}