Skip to content

dloch/tabletariat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tabletariat

A library for interfacing between all of your tabs, in a masterless way.

Tabs and windows of the world, unite! After initial setup, know about all sibling, parent, ancestor, and cousin tabs or windows, stay in touch, and offload work according to your need.

Put slightly more simply: An event based communication library for tabs and windows.

##To build:

  npm install
  coffee -co dist src

##To use: Just include tabletariat.js on your site. Tabs spawned will automatically let their creators know about themselves, who will in turn tell of of their peers.

Adding events is similar to jquery (But maybe without the nice frills):

  require(["tabletariat"], function(t){
    t.on("eventname", function(event){ console.debug("I'm an event"); });
    t.one("eventname", function(event){ console.debug("I'll only run once"); });
  })

So is removing events:

  require(["tabletariat"], function(t){
    t.off("eventname");
  })

You can even remove specific events, if you really want to:

  require(["tabletariat"], function(t){
    var callback = function(){ console.debug("Keep track of me"); };
    t.on("eventname", callback);
    t.on("eventname", function(){ console.debug("Leave me here"); });
    t.off("eventname", callback);
  })

Whenever you need help with your work, just let everyone know:

  require(["tabletariat"], function(t){
    t.broadcast({eventname: "Variables"});
  })

I would highly not recommend removing the commAction event. If you do so, you'll probably break being aware of new worker tabs or windows.

About

Distributed cross-tab communication

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors