-
-
Notifications
You must be signed in to change notification settings - Fork 29
Events
Shobhit Sharma edited this page Oct 4, 2017
·
8 revisions
Embedo has internal event listeners implemented which emits following events:
These events are always attached to each embedo .load() call instance. They act much like promises for .done() to resolve or .fail() to catch error in chain.
embedo.load(arguments).done(Function).fail(Function)| Event | Dispatchers | Description |
|---|---|---|
watch |
on/once/off | When an element has loaded or size is modified in DOM |
refresh |
on/once/off | When a refresh event is finished |
destroy |
on/once/off | When embedo instance(s) are destroyed |
error |
on/once/off | Exception handler happened during embed |
During lifecycle of Embedo class, all instances are stored in memory to emit and handle necessary events for DOM. They listen to any change in size, destroyed or refreshed instances all in once place. The arguments contain meta data which helps to log and understand which particular instance has been called.
embedo.on('watch', (request) => {});
embedo.on('refresh', (request, data) => {});
embedo.on('destroy', (request) => {});
embedo.on('error', (error) => {});