本文整理匯總了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);