How to use the naja.fireEvent function in naja

To help you get started, we’ve selected a few naja examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / naja / naja-tests.ts View on Github external
document.addEventListener('DOMContentLoaded', () => {
    naja.initialize();
    naja.initialize({ history: false, selector: '[data-ajax]', customOption: 1 });
    naja.fireEvent('customEvent', { extra: 1 });
    naja.fireEvent('anotherEvent');
    naja.addEventListener('testEvent', handler);
    naja.addEventListener('someEvent', event => console.log(event.target));
    naja.removeEventListener('testEvent', handler);
    naja.removeEventListener('someEvent', event => {});
    naja.addEventListener('otherEvent', event => console.log(event.otherProperty === 1));
});
github DefinitelyTyped / DefinitelyTyped / types / naja / naja-tests.ts View on Github external
document.addEventListener('DOMContentLoaded', () => {
    naja.initialize();
    naja.initialize({ history: false, selector: '[data-ajax]', customOption: 1 });
    naja.fireEvent('customEvent', { extra: 1 });
    naja.fireEvent('anotherEvent');
    naja.addEventListener('testEvent', handler);
    naja.addEventListener('someEvent', event => console.log(event.target));
    naja.removeEventListener('testEvent', handler);
    naja.removeEventListener('someEvent', event => {});
    naja.addEventListener('otherEvent', event => console.log(event.otherProperty === 1));
});