Skip to content

the easiest way to build real-time web applications

Notifications You must be signed in to change notification settings

emilisto/hook.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hook.js - alpha

the easiest way to build real-time web applications

Usage

Just include this on any page:

 <script type="text/javascript" src="hook.js"></script>

Now you have access to the "hook" object. The hook object is special object which gives you the ability to seamlessly call server events from the browser and browser events from the server.

Emitter API

// Browser
hook.emit('hello', 'dog');

// Server
hook.on('browser::hello', function(data){
  // outputs 'dog'
  console.log(data);
});

Emitter Callback API

``` js // Browser hook.emit('hello', function(err, result){ // outputs 'sup' console.log(result); });

// Server hook.on('browser::hello', function(callback){ callback(null, 'sup'); });

About

the easiest way to build real-time web applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published