本文整理汇总了TypeScript中@ephox/boulder.ValueSchema.getOrDie方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ValueSchema.getOrDie方法的具体用法?TypeScript ValueSchema.getOrDie怎么用?TypeScript ValueSchema.getOrDie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/boulder.ValueSchema
的用法示例。
在下文中一共展示了ValueSchema.getOrDie方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const specs = Arr.map(Obj.keys(panelConfigs), (name) => {
const spec = panelConfigs[name];
const bridged = ValueSchema.getOrDie(BridgeSidebar.createSidebar(spec));
return {
name,
getApi,
onSetup: bridged.onSetup,
onShow: bridged.onShow,
onHide: bridged.onHide
};
});
示例2: renderToolbarToggleButtonWith
const renderContextToggleButton = (memInput: MementoRecord, button: Toolbar.ContextToggleButton, extras) => {
const { primary, ...rest } = button.original;
const bridged = ValueSchema.getOrDie(
Toolbar.createToggleButton({
...rest,
type: 'togglebutton',
onAction: () => { }
})
);
return renderToolbarToggleButtonWith(bridged, extras.backstage.shared.providers, [
runOnExecute<Toolbar.ToolbarButtonInstanceApi>(memInput, button)
]);
};
示例3: navigate
const registerForm = (key: string, toolbarApi: Toolbar.ContextFormApi) => {
const contextForm = ValueSchema.getOrDie(Toolbar.createContextForm(toolbarApi));
forms[key] = contextForm;
contextForm.launch.map((launch) => {
// Use the original here (pre-boulder), because using as a the spec for toolbar buttons
formNavigators['form:' + key + ''] = {
...toolbarApi.launch,
type: (launch.type === 'contextformtogglebutton' ? 'togglebutton' : 'button') as any,
onAction: () => {
navigate(contextForm);
}
};
});
if (contextForm.scope === 'editor') {
inEditorScope.push(contextForm);
} else {
inNodeScope.push(contextForm);
}
lookupTable[key] = contextForm;
};
示例4:
const validateData = <T extends Types.Dialog.DialogData>(data: T, validator: Processor) => {
return ValueSchema.getOrDie(ValueSchema.asRaw('data', validator, data));
};
示例5:
return Reflecting.getState(root).get().map((dialogState: DialogManager.DialogInit<T>) => {
return ValueSchema.getOrDie(
ValueSchema.asRaw('data', dialogState.dataValidator, data)
);
}).getOr(data);