本文整理汇总了TypeScript中@ephox/katamari.Arr.find方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Arr.find方法的具体用法?TypeScript Arr.find怎么用?TypeScript Arr.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Arr
的用法示例。
在下文中一共展示了Arr.find方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const getItemSelection = (editor: Editor): Option<ItemSelection> => {
const selectedListItems = Arr.map(Selection.getSelectedListItems(editor), Element.fromDom);
return Options.liftN([
Arr.find(selectedListItems, Fun.not(hasFirstChildList)),
Arr.find(Arr.reverse(selectedListItems), Fun.not(hasFirstChildList))
], (start, end) => ({ start, end }));
};
示例2:
const lookup = (compInSystem: AlloyComponent, footerButtons: DialogMemButton[], buttonName: string) => {
return Arr.find(footerButtons, (button) => {
return button.name === buttonName;
}).bind((memButton) => {
return memButton.memento.getOpt(compInSystem);
});
};
示例3: function
Chain.async(function (container, next, die) {
return Arr.find(editor.windowManager.getWindows(), function (win) {
return container.dom().id === win._id;
}).fold(() => die('Could not find popup window'), function (win) {
next(win);
});
})
示例4: function
Chain.on(function (container, next, die) {
return Arr.find(editor.windowManager.getWindows(), function (win) {
return container.dom().id === win._id;
}).fold(die, function (win) {
next(Chain.wrap(win));
});
})
示例5:
const scanAndSet = (dialogApi: Types.Dialog.DialogInstanceApi<typeof initialData>, pattern: string) => {
Arr.find(charMap, (group) => group.name === currentTab.get()).each((f) => {
const items = Scan.scan(f, pattern);
dialogApi.setData({
results: items
});
});
};
示例6: handler
AlloyEvents.run<SystemEvents.AlloySlotVisibilityEvent>(SystemEvents.slotVisibility(), (sidepanel, se) => {
const data = se.event();
const optSidePanelSpec = Arr.find(specs, (config) => config.name === data.name());
optSidePanelSpec.each((sidePanelSpec) => {
const handler = data.visible() ? sidePanelSpec.onShow : sidePanelSpec.onHide;
handler(sidePanelSpec.getApi(sidepanel));
});
})
示例7: function
const maybeUrlize = function (editor, key) {
return Arr.find(PluginUrls.urls, function (x) {
return x.key === key;
}).fold(function () {
const getMetadata = editor.plugins[key].getMetadata;
return typeof getMetadata === 'function' ? makeLink(getMetadata()) : key;
}, function (x) {
return makeLink({ name: x.name, url: 'https://www.tinymce.com/docs/plugins/' + x.key });
});
};
示例8: function
const getServiceErrorMsg = function (type) {
return Arr.find(friendlyServiceErrors, function (error) {
return error.type === type;
}).fold(
Fun.constant('Unknown service error'),
function (error) {
return error.message;
}
);
};
示例9: function
return Step.sync(function () {
state.set([]);
const matches = MatchKeys.match(patterns, event);
Assertions.assertEq('Should have some matches', true, matches.length > 0);
Arr.find(matches, function (pattern) {
return pattern.action();
});
Assertions.assertEq('Should have the expected state', expectedData, state.get());
});