简化工具函数

This commit is contained in:
zhw2590582 committed 2019-11-22 20:50:14 +08:00
1 parent be4d1d0437
commit 1270167a3e
26 files changed
+182 -152

No files matched your search

+3 -3
View File
@@ -1,4 +1,4 @@
import { clamp } from '../utils';
import { clamp, def } from '../utils';
export default function volumeMix(art, player) {
const {
@@ -8,7 +8,7 @@ export default function volumeMix(art, player) {
storage,
} = art;
Object.defineProperty(player, 'volume', {
def(player, 'volume', {
get: () => $video.volume || 0,
set: percentage => {
$video.volume = clamp(percentage, 0, 1);
@@ -20,7 +20,7 @@ export default function volumeMix(art, player) {
},
});
Object.defineProperty(player, 'muted', {
def(player, 'muted', {
get: () => $video.muted,
set: muted => {
$video.muted = muted;