Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Using events

Jason Mulligan edited this page Dec 27, 2012 · 3 revisions

Using events

abaaso has a global observer. All core functions fire before & after events, which allows you to wire a reactive GUI without much effort.

You can also fire custom events from Strings, Numbers, Objects or Arrays (contents). This affords the freedom define an event structure for your application.

var obj = {id: "something",};

// Hooking the observer to obj
$.hook(obj);

// Firing a custom event
obj.fire("ready");

Logging

You can observe events in the console by enabling logging.

$.logging = true;

Latency

DOM mutations, such as rendering a data list as data streams into the data store, can be slow on older browsers like Internet Explorer 8.

If latency is a concern, it's recommended to discard events until the I/O operation is complete.

$.discard(true);

// Heavy I/O op(s) here

$.discard(false);