@ exodus/ ui- config
用于存储各种UI特定设置/配置的助手 。 仅用于用户界面特定设置/配置 。 大多数数据都不是UI的特异性,应当由背景中的特定域特征/模块/原子来管理.
有效实例:
- 在 UI 中控制是否显示价格图的布尔旗
- 显示登入后翻转为正的布尔旗
- 显示或需要显示模式的计数器
使用量
import uiConfig from '@exodus/ui-config'
// exodus is created via `@exodus/headless`
exodus.use(
uiConfig({
config: [
// Note: these are NOT atom definitions, they're only metadata about atoms: `id` and later `type` (so we can
// internally instantiate different types of atoms)
//
// these are emitted to the `port` as events 'delightUser' and 'terrifyUser'
{ id: 'delightUser' },
{ id: 'terrifyUser' },
],
})
)
// API usage
exodus.uiConfig.delightUser(true)
exodus.uiConfig.terrifyUser(false)
// 港口活动
特性以下列格式从原子中发送数据: port.emit('delightUserAtom', value)