logo

NJP

custom event API info

Import · Jan 07, 2020 · article

addendum to the CustomEvent documentation, provided by HI support on 1-6-2020

original SN Docs

https://docs.servicenow.com/bundle/newyork-application-development/page/app-store/dev_portal/API_ref...

https://developer.servicenow.com/app.do#!/api%5Fdoc?v=newyork&id=customEventClientAPI

/** * Version of CustomEvent that doesn't require any dependencies. Supports IE9+. * * CustomEvent API exposes: * * #observe(name, fn) * register a handler for event (equivalent to #on, but with * tracing) * * #fire(name, payload) * fire an event on the current frame (equivalent to #fireEvent, * but with tracing) * * #fireUp(name, payload) * Fire an event recursively up window.parent to the top frame * starting in the window that fireUp was called. * Can be stopped by returning false from a registered callback. * * #fireTop(name, payload) * fire an event to this frame and the top frame * * #fireAll(name, payload) * fire an event to the top frame, and then recursively to all its * children. * * #fireToWindow(targetWindow, name, payload, usePostMessage, targetOrigin) * fire an event to a specified target window * Optionally usePostMessage with targetOrigin for crossDomain use cases. * * #on(event, fn) * register a handler for event (equivalent to #observe) * * #un(event, fn) * unregister the given handler function from the given event * * #unAll(event) * unregister all handlers for event * * #forward(name, element, fn) * forward the DOM event name on the given element to handler fn * as a #on() observation * * #isFiring() * true if an event is currently firing, else false * * #fireEvent(name, payload) * fire an event on the current frame *

*/

View original source

https://www.servicenow.com/community/north-carolina-snug/custom-event-api-info/ta-p/2320406