How to detect the value of useCapture from an event object?
I made a function that removes an event listener after firing once or any number of times.
This is what I have:
/*jslint browser: true, vars: true, white: true, maxerr: 50, indent: 4 */
(function ()
{
"use strict";
function removeEventListenerAfterFiring(numberOfTimes, callback, useCapture)
{
var count = 0;
return function listener(event)
{
count += 1;
if (count >= numberOfTimes)
{
event.target.removeEventListener(event.type, listener, useCapture);
}
callback();
};
}
function functionName()
{
// Code here.
}
window.addEventListener("DOMContentLoaded", removeEventListenerAfterFiring(1, functionName, false), false);
}());
Is there a way to detect the value of useCapture so that I don’t have to pass it to the removeEventListenerAfterFiring function?
Go for the easy way; remove both.