Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gazette

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gazette

Add pubsub to anything. Ender compliant.

  • 0.9.4
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

   ,ad8888ba,                                                                    
 d8"'    `"8b                                       ,d       ,d                 
d8'                                                 88       88                 
88             ,adPPYYba,  888888888   ,adPPYba,  MM88MMM  MM88MMM   ,adPPYba,  
88      88888  ""     `Y8       a8P"  a8P_____88    88       88     a8P_____88  
Y8,        88  ,adPPPPP88    ,d8P'    8PP"""""""    88       88     8PP"""""""  
 Y8a.    .a88  88,    ,88  ,d8"       "8b,   ,aa    88,      88,    "8b,   ,aa  
  `"Y88888P"   `"8bbdP"Y8  888888888   `"Ybbd8"'    "Y888    "Y888   `"Ybbd8"'  

Add pubsub to anything

General Use


var gazette = require("gazette");

gazette.subscribe("foo", function(args) {
  console.log(args);
});

gazette.publish("foo", "bar"); //=> "bar"

Infuse something with pubsub


var sample = require("gazette").infuse({
  greeting: "Hello"
});

sample.subscribe("hello", function(args) {
  console.log(this.greeting + ", " + args.toString()); 
});

sample.publish("hello", "Nate"); //=> "Hello, Nate"

or infuse an existing object


var gazette = require("./gazette");
,   sample  = { greeting: "Hello" };

gazette.infuse(sample);

Ender.js

Simple add gazette to your build


  $.subscribe("hello", function() { 
    console.log("greetings") 
  });
  
  $.publish("hello");
  
  $("#dom-element").subscribe("event", function(args) { 
    console.log("Event fired. Arguments: ", args); 
  });
  
  $.publish("event", ["foo", "bar"]); //=> "Event fired. Arguments: foo, bar"

FAQs

Package last updated on 29 Dec 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc