tinymce.full.js
function on(name, callback, prepend, extra) {
        var handlers, names, i;

        if (callback === false) {
          callback = returnFalse;
        }

        if (callback) {
          callback = {
            func: callback
          };

          if (extra) {
            Tools.extend(callback, extra);
          }

          names = name.toLowerCase().split(' ');
          i = names.length;
          while (i--) {
            name = names[i];
            handlers = bindings[name];
            if (!handlers) {
              handlers = bindings[name] = [];
              toggleEvent(name, true);
            }

            if (prepend) {
              handlers.unshift(callback);
            } else {
              handlers.push(callback);
            }
          }
        }

        return self;
      }
function on(name, callback, prepend, extra) {
        var handlers, names, i;

        if (callback === false) {
          callback = returnFalse;
        }

        if (callback) {
          callback = {
            func: callback
          };

          if (extra) {
            Tools.extend(callback, extra);
          }

          names = name.toLowerCase().split(' ');
          i = names.length;
          while (i--) {
            name = names[i];
            handlers = bindings[name];
            if (!handlers) {
              handlers = bindings[name] = [];
              toggleEvent(name, true);
            }

            if (prepend) {
              handlers.unshift(callback);
            } else {
              handlers.push(callback);
            }
          }
        }

        return self;
      }
function on ( name , callback , prepend , extra ) { var handlers , names , i ; if ( callback === false ) { callback = returnFalse ; } if ( callback ) { callback = { func : callback } ; if ( extra ) { Tools . extend ( callback , extra ) ; } names = name . toLowerCase ( ) . split ( ' ' ) ; i = names . length ; while ( i -- ) { name = names [ i ] ; handlers = bindings [ name ] ; if ( ! handlers ) { handlers = bindings [ name ] = [ ] ; toggleEvent ( name , true ) ; } if ( prepend ) { handlers . unshift ( callback ) ; } else { handlers . push ( callback ) ; } } } return self ; }
Binds an event listener to a specific event by name.

@method on
@param {String} name Event name or space separated list of events to bind.
@param {callback} callback Callback to be executed when the event occurs.
@param {Boolean} first Optional flag if the event should be prepended. Use this with care.
@return {Object} Current class instance.
@example
instance.on('event', function(e) {
// Callback logic
});
Binds an event listener to a specific event by name .