File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -110,8 +110,10 @@ const Webcams = () => {
110110 player . webcams . on ( 'play' , ( ) => {
111111 const frequency = getFrequency ( ) ;
112112 interval . current = setInterval ( ( ) => {
113- const currentTime = player . webcams . currentTime ( ) ;
114- dispatchTimeUpdate ( currentTime ) ;
113+ if ( player . webcams ) {
114+ const currentTime = player . webcams . currentTime ( ) ;
115+ dispatchTimeUpdate ( currentTime ) ;
116+ }
115117 } , 1000 / ( frequency ? frequency : config . rps ) ) ;
116118 } ) ;
117119
Original file line number Diff line number Diff line change @@ -43,18 +43,19 @@ export default class Shortcuts {
4343 return null ;
4444 }
4545
46- const listener = document . addEventListener ( 'keydown' , ( e ) => {
47- if ( e . altKey && e . shiftKey ) {
48- if ( e . key === key ) action ( ) ;
46+ const handler = ( e ) => {
47+ if ( e . altKey && e . shiftKey && e . key === key ) {
48+ action ( ) ;
4949 }
50- } ) ;
50+ } ;
5151
52- this . listeners . push ( listener ) ;
52+ document . addEventListener ( 'keydown' , handler ) ;
53+ this . listeners . push ( handler ) ;
5354 }
5455
5556 destroy ( ) {
5657 this . listeners . forEach ( listener => {
57- document . removeEventListener ( listener ) ;
58+ document . removeEventListener ( 'keydown' , listener ) ;
5859 } ) ;
5960 }
6061}
You can’t perform that action at this time.
0 commit comments