From 44789de283340f3dbda84b731e04ccfa6eb78199 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Sat, 4 Oct 2014 12:26:49 +0200 Subject: [PATCH 1/2] add support for amd loading --- src/backpusher.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/backpusher.js b/src/backpusher.js index a525762..869f324 100644 --- a/src/backpusher.js +++ b/src/backpusher.js @@ -1,10 +1,22 @@ -// Backpusher.js 0.0.2 +// Backpusher.js 0.0.3 // (c) 2011-2012 Pusher. +// (c) 2014 Koen Punt (koen@fetch.nl). // Backpusher may be freely distributed under the MIT license. // For all details and documentation: // http://github.com/pusher/backpusher -;(function(exports, undefined){ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['backbone'], factory); + } else if (typeof exports === 'object') { + // CommonJS + module.exports = factory(require('backbone')); + } else { + // Browser globals + root.Backpusher = factory(root.Backbone); + } +})(this, function(Backbone, undefined){ // The top-level namespace. All public Backbone classes and modules will // be attached to this. Exported for both CommonJS and the browser. var Backpusher = function(channel, collection, options) { @@ -103,6 +115,6 @@ return origBackboneSync(method, model, options); }; - // Export: - exports.Backpusher = Backpusher; -})((typeof exports !== 'undefined' ? exports : this)); \ No newline at end of file + return Backpusher; + +}); \ No newline at end of file From 8aa758442bac0dd655a3dd6418837ca0f06ff1a9 Mon Sep 17 00:00:00 2001 From: Koen Punt Date: Sat, 4 Oct 2014 12:27:05 +0200 Subject: [PATCH 2/2] create bower component --- bower.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 bower.json diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..3436278 --- /dev/null +++ b/bower.json @@ -0,0 +1,28 @@ +{ + "name": "backpusher", + "version": "0.0.3", + "homepage": "https://github.com/fetch/backpusher", + "authors": [ + "Koen Punt " + ], + "description": "Backpusher is a library for using Pusher to sync your Backbone models between clients, the server and other clients.", + "main": "src/backpusher.js", + "moduleType": [ + "amd", + "globals" + ], + "keywords": [ + "pusher", + "backbone", + "push", + "realtime" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +}