UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

21 lines (17 loc) 471 B
/** * * @param {SignalHandler[]} handlers * @param {function} f * @param {*} ctx * @returns {number} index of the handler, or -1 if not found */ export function findSignalHandlerIndexByHandleAndContext(handlers, f, ctx) { const l = handlers.length; for (let i = 0; i < l; i++) { const handler = handlers[i]; if (handler.handle === f && handler.context === ctx) { return i; } } return -1; }