当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ui.UIExtensionExports类代码示例

本文整理汇总了TypeScript中@bhmb/ui.UIExtensionExports的典型用法代码示例。如果您正苦于以下问题:TypeScript UIExtensionExports类的具体用法?TypeScript UIExtensionExports怎么用?TypeScript UIExtensionExports使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UIExtensionExports类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
}
开发者ID:Bibliofile,项目名称:BHMB-List-Manager,代码行数:27,代码来源:index.ts

示例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 })
    })
开发者ID:Bibliofile,项目名称:BHMB-List-Manager,代码行数:16,代码来源:index.ts

示例3:

 worlds.forEach(world => {
   ui.buildTemplate(template, worldsDiv, [
     { selector: '[data-for=worldId]', value: world.id },
     { selector: '[data-for=worldName]', text: world.name }
   ])
 })
开发者ID:Bibliofile,项目名称:BHMB-List-Manager,代码行数:6,代码来源:index.ts


注:本文中的@bhmb/ui.UIExtensionExports类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。