separate variable constants

This commit is contained in:
Harvey committed 2022-04-27 10:42:07 +08:00
1 parent 57a14f63ac
commit fc3abd7d1d
20 files changed
+143 -80

No files matched your search

+2 -1
View File
@@ -2,6 +2,7 @@ import { includeFromEvent, isMobile } from '../utils';
export default function clickInit(art, events) {
const {
constructor,
template: { $player, $video },
} = art;
@@ -19,7 +20,7 @@ export default function clickInit(art, events) {
events.proxy($video, 'click', () => {
const now = Date.now();
if (now - clickTime <= 300) {
if (now - clickTime <= constructor.DB_CLICE_TIME) {
art.emit('dblclick');
if (isMobile) {
+3 -2
View File
@@ -51,6 +51,7 @@ export default function gestureInit(art, events) {
const {
notice,
plugins,
constructor,
template: { $video },
} = art;
@@ -69,8 +70,8 @@ export default function gestureInit(art, events) {
clearTimeout(pressTimer);
pressTimer = setTimeout(() => {
art.playbackRate = 3;
}, 1000);
art.playbackRate = constructor.MOBILE_AUTO_PLAYBACKRATE;
}, constructor.MOBILE_AUTO_PLAYBACKRATE_TIME);
}
});
+1 -1
View File
@@ -10,7 +10,7 @@ export default function resizeInit(art, events) {
art.aspectRatioReset = true;
notice.show = '';
art.emit('resize');
}, 500);
}, art.constructor.RESIZE_TIME);
events.proxy(window, ['orientationchange', 'resize'], () => {
resizeFn();
+3 -2
View File
@@ -3,12 +3,13 @@ import { throttle, isInViewport } from '../utils';
export default function viewInit(art, events) {
const {
option,
constructor,
template: { $container },
} = art;
const scrollFn = throttle(() => {
art.emit('view', isInViewport($container, 50));
}, 200);
art.emit('view', isInViewport($container, constructor.SCROLL_GAP));
}, constructor.SCROLL_TIME);
events.proxy(window, 'scroll', () => {
scrollFn();