Skip to content

Instantly share code, notes, and snippets.

@n3ksus
Created June 29, 2016 09:52
Show Gist options
  • Save n3ksus/e5a8caf21c8b5eaac73c6712094194fa to your computer and use it in GitHub Desktop.
Save n3ksus/e5a8caf21c8b5eaac73c6712094194fa to your computer and use it in GitHub Desktop.
(function (root, factory) {
if(typeof define === "function" && define.amd) {
define(["postal"], factory);
} else if(typeof module === "object" && module.exports) {
module.exports = factory(require("postal"));
} else {
root.myModule = factory(root.postal);
}
}(this, function(postal) {
var sub;
var ch = postal.channel("myModule");
var myModule = {
sayHi:function() {
ch.publish("hey.yall", { msg: "myModule sez hai" });
},
dispose: function() {
sub.unsubscribe();
}
};
return myModule;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment