// local dependencies
import store from '../../store/store';
import C from '../../constants/constants';
/**
* Removes the callback's associated with the WebGL canvas element. If no callback is provided,
* all callback associated with the event are removed.
*
* @module off
* @memberOf module:rootComponents
* @param {object} event - The event to remove the provided callback.
* @param {function} [callback] - The specific callback to remove from the `event`.
* @returns {self} - Chainable api by returning the instance.
*
* @example
* function clickCallback() {
* console.log('CLICKED');
* }
*
* $$$
* .on('click', clickCallback)
* .trigger('click') // logs 'CLICKED'
* .off('click', clickCallback)
* .trigger('click'); // no log
*
* $$$
* .on('click', clickCallback)
* .trigger('click') // logs 'CLICKED'
* .off('click') // all callbacks associated with `click` are removed
*/
export default function (event, callback) {
store
.get(C.$CANVAS)
.off(event, callback);
return this;
};