本文整理汇总了TypeScript中@bhmb/ui.UIExtensionExports.notify方法的典型用法代码示例。如果您正苦于以下问题:TypeScript UIExtensionExports.notify方法的具体用法?TypeScript UIExtensionExports.notify怎么用?TypeScript UIExtensionExports.notify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@bhmb/ui.UIExtensionExports
的用法示例。
在下文中一共展示了UIExtensionExports.notify方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createUI
async function createUI(list: keyof WorldLists, tab: HTMLDivElement, ui: UIExtensionExports) {
// Show worlds
const { worlds, settings } = await showWorlds(tab, ui)
// Get the lists and modify as required
ui.notify('Getting lists')
const lists = await Promise.all(worlds.map(getWorldLists))
let superList = flatten(pluck(lists, list))
if (settings.alphabetical) superList.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))
if (settings.removeDuplicates) superList = unique(superList)
// Let the user edit the list
superList = await displayList(tab, superList)
// Choose which worlds to push the new list to
const { worlds: pushWorlds, settings: pushSettings } = await choosePushWorlds(tab, ui)
ui.notify('Pushing lists...')
const requests = pushWorlds.map(async world => {
const api = new MessageBot.dependencies.Api(world)
const lists = await getWorldLists(world)
pushSettings.mode == 'overwrite' ? lists[list] = superList : lists[list].push(...superList)
await api.setLists(lists)
})
await Promise.all(requests)
setTimeout(createUI, 1, list, tab, ui)
}
示例2: resolve
button.addEventListener('click', () => {
const ids = Array.from(worldsDiv.querySelectorAll('input'))
.filter(input => input.checked)
.map(input => input.value)
if (ids.length < 1) {
ui.notify('Please select at least one world')
return
}
const settings: PushSettings = {
mode: (tab.querySelector('[name=mode]:checked') as HTMLInputElement).value as 'overwrite' | 'append',
}
resolve({ worlds: worlds.filter(({ id }) => ids.includes(id)), settings })
})