Jquery-pub-sub is a project mainly written in JavaScript, it's free.
You can view the following project at the URL below. Interaction is done via console (obviously!) The low level API is exposed in global `ns`.
This started purely as an experiment with Pub/Sub, but has grown into a class based architecture.
Please know, I'm perfectly aware of how inefficient this is, this is purely just fooling around and trying to mimic a compiled language on the client side.
Goals for this experiment:
ns
.At this point, I've really only refined the high level API for usage.
API.newUser( **string** username, _optional_ **integer** interval );
This will start a new widget instance on the page with the specified user. If you specify an interval, this will set the interval at which the updates process. If no interval is set, interval defaults to 3000ms.
API.deleteUser( **string** username );
This removes the widget with the set username, deletes all references on the page to this user, destroys all pubsub actions associated, and deletes all keys created for the user.
var _myObject_ = new API.NewSubscription( **object** { 'user' : **string** username, 'handle' : **string** subscriptionLabel }, **function** callback);
or
var _myObject_ = new API.NewSubscription( **string** username, **function** callback);
returns .destroy(), .handle();
This will allow you to create a callback to the publish event on the specified user. If you do not specify a handle, it will be automatically generated for you and can be called with the .handle()
method.
The high level API returns an object to represent the specific callback mapped to this request.
_myObject_.destroy()
Deletes the callback subscription associated to this object.