Files
ArtPlayer/packages/artplayer/src/control/setting.ts
T

27 lines
747 B
TypeScript

import type { ControlFactory, ControlOption } from './types'
import { appendElement } from '../component/dom'
import { tooltip } from '../utils'
import { controlEvents } from './resources'
export default function setting(option: ControlOption): ControlFactory {
return art => ({
...option,
tooltip: art.i18n.get('Show Setting'),
mounted: ($control) => {
const { on, proxy } = controlEvents(art, $control)
const { icons, i18n } = art
appendElement($control, icons.setting)
proxy($control, 'click', () => {
art.setting.toggle()
art.setting.resize()
})
on('setting', (value) => {
tooltip($control, i18n.get(value ? 'Hide Setting' : 'Show Setting'))
})
},
})
}