This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const scrollEvent = new KeyboardEvent('keydown', { | |
key: 'ArrowDown', | |
code: 'ArrowDown', | |
keyCode: 40, | |
which: 40, | |
bubbles: true, | |
cancelable: true | |
}); | |
function attachEndedListener(video) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function EventManager() { | |
var handlers = {}, queue = {}; | |
function trigger(event) { | |
var args = [].slice.call(arguments, 1); | |
if (event in handlers) handlers[event].forEach(function (handler) { handler.apply(null, args); }); | |
} | |
function on(event, handler) { | |
if (typeof handler != "function") throw new Error(event + " handler must be a function"); |