mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-22 13:21:20 -08:00
refactor(core): [CORE-20] type entry and converge initialization
This commit is contained in:
1 parent
ccf77c4ed2
commit
ee895a558f
100 files changed
+33854
-839
No files matched your search
@@ -0,0 +1,24 @@
|
||||
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
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user