Remove an event listener after firing once or any number of timesThis 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 anything that could be improved, or is there a better way to do this?Is it acceptable to specify useCapture twice? Is there a way to detect if useCapture has been specified so that I don't have to pass it to the removeEventListenerAfterFiring function?
Remove an event listener after firing once or any number of times
javascript;event handling;callback