You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* A very basic event module that helps to generate and catch events.
*
* @module Chartist.Event
*/
/* global Chartist */
(function(globalRoot,Chartist){
'use strict';
Chartist.EventEmitter=function(){
varhandlers=[];
/**
* Add an event handler for a specific event
*
* @memberof Chartist.Event
* @param {String} event The event name
* @param {Function} handler A event handler function
*/
functionaddEventHandler(event,handler){
handlers[event]=handlers[event]||[];
handlers[event].push(handler);
}
/**
* Remove an event handler of a specific event name or remove all event handlers for a specific event.
*
* @memberof Chartist.Event
* @param {String} event The event name where a specific or all handlers should be removed
* @param {Function} [handler] An optional event handler function. If specified only this specific handler will be removed and otherwise all handlers are removed.
*/
functionremoveEventHandler(event,handler){
// Only do something if there are event handlers with this name existing
if(handlers[event]){
// If handler is set we will look for a specific handler and only remove this