Skip to content

astandrik/Warden.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warden.js

Small declarative library for event-driven development

Warden.js library provides a functionality for the development of event-driven web-applications without any dependencies. You can emit custom events with .emit() method and listen them with .on() method, you can also listen native DOM events. But the greatest is you can create and maintain event-streams with .stream() and programming event-bus.

##Warden.create##

There is no dependencies with DOM, jQuery events or another event emitting system in the Warden library. If you want to your object can emit, listen and creating streams of events you should use Warden.create method.

Warden.create(constructor, [config])

var Clicker = Warden.create(function Clicker(btn){
	this.btn = btn;
});

or

function Clicker(btn){
	this.btn = btn;
}
Warden.create(Clicker);

Now Clicker class has methods .on, .emit and .stream and you can use them.

####Configuration#### You can configure next terms:

  • max - Count of maximal handlers per one event type. Default: 128

###Methods### ####emit#### .emit(event) Emitting custom event. Event argument required type property. ####on#### .on(type, callback, [config]) Binding callback as a handler for events which type is type. ####stream#### .stream(type, [listenerFunction]) Creates event stream.

About

Declarative event-driven development library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.3%
  • CoffeeScript 1.7%