mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-12 06:26:16 -08:00
25 lines
616 B
TypeScript
25 lines
616 B
TypeScript
import { def } from '../utils'
|
|
|
|
export interface AttributeMethods {
|
|
attr: {
|
|
(key: PropertyKey): unknown
|
|
(key: PropertyKey, value: unknown): unknown
|
|
}
|
|
}
|
|
|
|
export default function attrMix(art: { template: { $video: object } }): void {
|
|
const {
|
|
template: { $video },
|
|
} = art
|
|
|
|
def(art, 'attr', {
|
|
value(key: PropertyKey, value?: unknown): unknown {
|
|
// attr intentionally exposes arbitrary native/proxy properties, including symbols.
|
|
const target = $video as Record<PropertyKey, unknown>
|
|
if (value === undefined)
|
|
return target[key]
|
|
target[key] = value
|
|
},
|
|
})
|
|
}
|