Skip to content

Instantly share code, notes, and snippets.

@jcreamer898
Created April 29, 2013 16:44
Show Gist options
  • Save jcreamer898/5482883 to your computer and use it in GitHub Desktop.
Save jcreamer898/5482883 to your computer and use it in GitHub Desktop.
Postal.js 101
//channels
var app = postal.channel( "app" );
var editor = postal.channel( "editor" );
var ui = postal.channel( "ui" );
app.subscribe("ready", function() {
});
// home.done, about.done, ...
app.subscribe("*.done", function() {
});
app.subcribe("model.#", function() {
});
app.subcribe("model.*.fetchdone", function(data, env) {
// if (env.topic.test(/font/)
});
// publish
app.publish("model.font.fetch", {
font: "arial"
});
app.subscribe("model.*.fetch", function( data, env ) {
//data.font
//env.data,
//env.topic
//env.timestamp
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment