The module editor's event manager

Hierarchy

  • EventEmitter

Implements

Properties

Constructors

Accessors

Methods

Properties

__key: string = '__JoditEventEmitterNamespaces'
currents: string[] = []

Constructors

Accessors

  • get current(): string
  • Get current event name

    Example

    parent.e.on('openDialog closeDialog', function () {
    if (parent.e.current === 'closeDialog') {
    alert('Dialog was closed');
    } else {
    alert('Dialog was opened');
    }
    });

    Returns string

Methods

  • Returns void

  • Emits an event to all handlers and calls them

    Returns

    false if one of the handlers return false

    Example

    var dialog = new Jodit.modules.Dialog();
    parent.e.on('afterClose', function () {
    dialog.destruct(); // will be removed from DOM
    });
    dialog.open('Hello world!!!');

    or you can trigger native browser listener

     var events = new Jodit.modules.EventEmitter();
    events.on(document.body, 'click',function (event) {
    alert('click on ' + event.target.id );
    });
    events.fire(document.body.querySelector('div'), 'click');

    Parameters

    • subjectOrEvents: string

      The object which is caused by certain events

    • Rest ...args: any[]

      Options for the event handler

    Returns any

  • Parameters

    • subjectOrEvents: object
    • eventsList: string | Event
    • Rest ...args: any[]

    Returns any

  • No handlers are triggered for the event

    Parameters

    • Optional event: string

    Returns boolean

  • Disable all handlers specified event ( Event List ) for a given element. Either a specific event handler.

    Example

    var a = {name: "Anton"};
    parent.e.on(a, 'open', function () {
    alert(this.name);
    });

    parent.e.fire(a, 'open');
    parent.e.off(a, 'open');
    var b = {name: "Ivan"}, hndlr = function () {
    alert(this.name);
    };
    parent.e.on(b, 'open close', hndlr);
    parent.e.fire(a, 'open');
    parent.e.off(a, 'open', hndlr);
    parent.e.fire(a, 'close');
    parent.e.on('someGlobalEvents', function () {
    console.log(this); // parent
    });
    parent.e.fire('someGlobalEvents');
    parent.e.off('someGlobalEvents');

    Parameters

    Returns EventEmitter

  • Parameters

    Returns EventEmitter

  • Stop execute all another listeners for this event

    Parameters

    • events: string

    Returns void

  • Parameters

    • subject: object
    • eventsList: string

    Returns void

Jodit PRO

If you like Jodit - try Jodit PRO