backbone.radio
Advanced tools
Comparing version 0.7.0 to 0.7.1
{ | ||
"name": "backbone.radio", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"homepage": "https://github.com/marionettejs/backbone.radio", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -1,2 +0,2 @@ | ||
// Backbone.Radio v0.7.0 | ||
// Backbone.Radio v0.7.1 | ||
(function(root, factory) { | ||
@@ -25,3 +25,3 @@ if (typeof define === 'function' && define.amd) { | ||
Radio.VERSION = '0.7.0'; | ||
Radio.VERSION = '0.7.1'; | ||
@@ -28,0 +28,0 @@ // This allows you to run multiple instances of Radio on the same |
@@ -1,4 +0,4 @@ | ||
// Backbone.Radio v0.7.0 | ||
// Backbone.Radio v0.7.1 | ||
!function(a,b){if("function"==typeof define&&define.amd)define(["backbone","underscore"],function(a,c){return b(a,c)});else if("undefined"!=typeof exports){var c=require("backbone"),d=require("underscore");module.exports=b(c,d)}else b(a.Backbone,a._)}(this,function(a,b){"use strict";function c(a,b,c){if(j.DEBUG){var d=c?" on the "+c+" channel":"";console.warn(a+d+': "'+b+'"')}}function d(a,b,c,d){if(!c)return!1;var e=[];if("object"==typeof c){for(var f in c)e.push(a[b].apply(a,[f,c[f]].concat(d)));return e}if(k.test(c)){for(var g=c.split(k),h=0,i=g.length;i>h;h++)e.push(a[b].apply(a,[g[h]].concat(d)));return e}return!1}function e(a,b,c){var d=c[0],e=c[1],f=c[2];switch(c.length){case 0:return a.call(b);case 1:return a.call(b,d);case 2:return a.call(b,d,e);case 3:return a.call(b,d,e,f);default:return a.apply(b,c)}}function f(a){return l[a]||(l[a]=b.partial(j.log,a))}function g(a){return b.isFunction(a)?a:b.constant(a)}var h=Array.prototype.slice,i=a.Radio,j=a.Radio={};j.VERSION="0.7.0",j.noConflict=function(){return a.Radio=i,this},j.DEBUG=!1;var k=/\s+/,l={};b.extend(j,{log:function(a,b){var c=h.call(arguments,2);console.log("["+a+'] "'+b+'"',c)},tuneIn:function(a){var b=j.channel(a);return b._tunedIn=!0,b.on("all",f(a)),this},tuneOut:function(a){var b=j.channel(a);return b._tunedIn=!1,b.off("all",f(a)),delete l[a],this}}),j.Commands={command:function(a){var b=h.call(arguments,1);if(d(this,"command",a,b))return this;var f=this.channelName,g=this._commands;if(f&&this._tunedIn&&j.log.apply(this,[f,a].concat(b)),g&&(g[a]||g["default"])){var i=g[a]||g["default"];b=g[a]?b:arguments,e(i.callback,i.context,b)}else c("An unhandled command was fired",a,f);return this},comply:function(a,b,c){return d(this,"comply",a,[b,c])?this:(this._commands||(this._commands={}),this._commands[a]={callback:b,context:c||this},this)},complyOnce:function(a,c,e){if(d(this,"complyOnce",a,[c,e]))return this;var f=this,g=b.once(function(){return f.stopComplying(a),c.apply(this,arguments)});return this.comply(a,g,e)},stopComplying:function(a){if(d(this,"stopComplying",a))return this;var b=this._commands;return a?b&&b[a]?delete b[a]:c("Attempted to remove the unregistered command",a,this.channelName):delete this._commands,this}},j.Requests={request:function(a){var b=h.call(arguments,1),f=d(this,"request",a,b);if(f)return f;var g=this.channelName,i=this._requests;if(g&&this._tunedIn&&j.log.apply(this,[g,a].concat(b)),i&&(i[a]||i["default"])){var k=i[a]||i["default"];return b=i[a]?b:arguments,e(k.callback,k.context,b)}c("An unhandled request was fired",a,g)},reply:function(a,b,c){return d(this,"reply",a,[b,c])?this:(this._requests||(this._requests={}),this._requests[a]={callback:g(b),context:c||this},this)},replyOnce:function(a,c,e){if(d(this,"replyOnce",a,[c,e]))return this;var f=this,h=b.once(function(){return f.stopReplying(a),g(c).apply(this,arguments)});return this.reply(a,h,e)},stopReplying:function(a){if(d(this,"stopReplying",a))return this;var b=this._requests;return a?b&&b[a]?delete b[a]:c("Attempted to remove the unregistered request",a,this.channelName):delete this._requests,this}},j._channels={},j.channel=function(a){if(!a)throw new Error("You must provide a name for the channel.");return j._channels[a]?j._channels[a]:j._channels[a]=new j.Channel(a)},j.Channel=function(a){this.channelName=a},b.extend(j.Channel.prototype,a.Events,j.Commands,j.Requests,{reset:function(){return this.off(),this.stopListening(),this.stopComplying(),this.stopReplying(),this}});var m,n,o=[a.Events,j.Commands,j.Requests];return b.each(o,function(a){b.each(a,function(a,b){j[b]=function(a){return n=h.call(arguments,1),m=this.channel(a),m[b].apply(m,n)}})}),j}); | ||
!function(a,b){if("function"==typeof define&&define.amd)define(["backbone","underscore"],function(a,c){return b(a,c)});else if("undefined"!=typeof exports){var c=require("backbone"),d=require("underscore");module.exports=b(c,d)}else b(a.Backbone,a._)}(this,function(a,b){"use strict";function c(a,b,c){if(j.DEBUG){var d=c?" on the "+c+" channel":"";console.warn(a+d+': "'+b+'"')}}function d(a,b,c,d){if(!c)return!1;var e=[];if("object"==typeof c){for(var f in c)e.push(a[b].apply(a,[f,c[f]].concat(d)));return e}if(k.test(c)){for(var g=c.split(k),h=0,i=g.length;i>h;h++)e.push(a[b].apply(a,[g[h]].concat(d)));return e}return!1}function e(a,b,c){var d=c[0],e=c[1],f=c[2];switch(c.length){case 0:return a.call(b);case 1:return a.call(b,d);case 2:return a.call(b,d,e);case 3:return a.call(b,d,e,f);default:return a.apply(b,c)}}function f(a){return l[a]||(l[a]=b.partial(j.log,a))}function g(a){return b.isFunction(a)?a:b.constant(a)}var h=Array.prototype.slice,i=a.Radio,j=a.Radio={};j.VERSION="0.7.1",j.noConflict=function(){return a.Radio=i,this},j.DEBUG=!1;var k=/\s+/,l={};b.extend(j,{log:function(a,b){var c=h.call(arguments,2);console.log("["+a+'] "'+b+'"',c)},tuneIn:function(a){var b=j.channel(a);return b._tunedIn=!0,b.on("all",f(a)),this},tuneOut:function(a){var b=j.channel(a);return b._tunedIn=!1,b.off("all",f(a)),delete l[a],this}}),j.Commands={command:function(a){var b=h.call(arguments,1);if(d(this,"command",a,b))return this;var f=this.channelName,g=this._commands;if(f&&this._tunedIn&&j.log.apply(this,[f,a].concat(b)),g&&(g[a]||g["default"])){var i=g[a]||g["default"];b=g[a]?b:arguments,e(i.callback,i.context,b)}else c("An unhandled command was fired",a,f);return this},comply:function(a,b,c){return d(this,"comply",a,[b,c])?this:(this._commands||(this._commands={}),this._commands[a]={callback:b,context:c||this},this)},complyOnce:function(a,c,e){if(d(this,"complyOnce",a,[c,e]))return this;var f=this,g=b.once(function(){return f.stopComplying(a),c.apply(this,arguments)});return this.comply(a,g,e)},stopComplying:function(a){if(d(this,"stopComplying",a))return this;var b=this._commands;return a?b&&b[a]?delete b[a]:c("Attempted to remove the unregistered command",a,this.channelName):delete this._commands,this}},j.Requests={request:function(a){var b=h.call(arguments,1),f=d(this,"request",a,b);if(f)return f;var g=this.channelName,i=this._requests;if(g&&this._tunedIn&&j.log.apply(this,[g,a].concat(b)),i&&(i[a]||i["default"])){var k=i[a]||i["default"];return b=i[a]?b:arguments,e(k.callback,k.context,b)}c("An unhandled request was fired",a,g)},reply:function(a,b,c){return d(this,"reply",a,[b,c])?this:(this._requests||(this._requests={}),this._requests[a]={callback:g(b),context:c||this},this)},replyOnce:function(a,c,e){if(d(this,"replyOnce",a,[c,e]))return this;var f=this,h=b.once(function(){return f.stopReplying(a),g(c).apply(this,arguments)});return this.reply(a,h,e)},stopReplying:function(a){if(d(this,"stopReplying",a))return this;var b=this._requests;return a?b&&b[a]?delete b[a]:c("Attempted to remove the unregistered request",a,this.channelName):delete this._requests,this}},j._channels={},j.channel=function(a){if(!a)throw new Error("You must provide a name for the channel.");return j._channels[a]?j._channels[a]:j._channels[a]=new j.Channel(a)},j.Channel=function(a){this.channelName=a},b.extend(j.Channel.prototype,a.Events,j.Commands,j.Requests,{reset:function(){return this.off(),this.stopListening(),this.stopComplying(),this.stopReplying(),this}});var m,n,o=[a.Events,j.Commands,j.Requests];return b.each(o,function(a){b.each(a,function(a,b){j[b]=function(a){return n=h.call(arguments,1),m=this.channel(a),m[b].apply(m,n)}})}),j}); | ||
//# sourceMappingURL=backbone.radio.min.js.map |
@@ -0,1 +1,5 @@ | ||
### [0.7.1](https://github.com/jmeas/backbone.radio/releases/tag/v0.7.1) | ||
- Corrects Underscore dependency. | ||
### [0.7.0](https://github.com/jmeas/backbone.radio/releases/tag/v0.7.0) | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "backbone.radio", | ||
"description": "The semantic messaging system for Backbone applications.", | ||
"version": "0.6.0", | ||
"homepage": "https://github.com/marionettejs/backbone.radio", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"homepage": "https://github.com/marionettejs/backbone.radio", | ||
@@ -45,3 +44,3 @@ "main": "build/backbone.radio.js", | ||
"backbone": ">=0.9.9 <=1.1.2", | ||
"underscore": ">=1.3.3 <=1.6.0" | ||
"underscore": ">=1.6.0 <=1.7.0" | ||
}, | ||
@@ -48,0 +47,0 @@ "devDependencies": { |
@@ -159,4 +159,4 @@ # Backbone.Radio | ||
```js | ||
// Get a reference to the channel named 'global' | ||
var globalChannel = Backbone.Radio.channel('global'); | ||
// Get a reference to the channel named 'user' | ||
var userChannel = Backbone.Radio.channel('user'); | ||
``` | ||
@@ -167,13 +167,11 @@ | ||
```js | ||
globalChannel.on('some:event', function() { | ||
userChannel.on('some:event', function() { | ||
console.log('An event has happened!'); | ||
}); | ||
globalChannel.comply('some:action', function() { | ||
userChannel.comply('some:action', function() { | ||
console.log('I was told to execute some action'); | ||
}); | ||
globalChannel.reply('some:request', function() { | ||
return 'food is good'; | ||
}); | ||
userChannel.reply('some:request', 'food is good'); | ||
``` | ||
@@ -184,7 +182,7 @@ | ||
```js | ||
globalChannel.trigger('some:event'); | ||
userChannel.trigger('some:event'); | ||
globalChannel.command('some:command'); | ||
userChannel.command('some:command'); | ||
globalChannel.request('some:request'); | ||
userChannel.request('some:request'); | ||
``` | ||
@@ -218,3 +216,3 @@ | ||
##### `command( commandName [, args...] )` | ||
#### `command( commandName [, args...] )` | ||
@@ -232,3 +230,3 @@ Order a command to be completed. Optionally pass arguments to send along to the callback. Like Backbone.Event's `trigger` method, | ||
##### `comply( commandName, callback [, context] )` | ||
#### `comply( commandName, callback [, context] )` | ||
@@ -261,3 +259,3 @@ Register a handler for `commandName` on this object. `callback` will be executed whenever the command is run. Optionally | ||
##### `complyOnce( commandName, callback [, context] )` | ||
#### `complyOnce( commandName, callback [, context] )` | ||
@@ -271,3 +269,3 @@ Register a handler for `commandName` that only executes a single time. | ||
##### `stopComplying( [commandName] )` | ||
#### `stopComplying( [commandName] )` | ||
@@ -283,3 +281,3 @@ If `commandName` is passed then that handler is removed from the object. Otherwise, all handlers are removed. | ||
##### `request( requestName [, args...] )` | ||
#### `request( requestName [, args...] )` | ||
@@ -297,3 +295,3 @@ Make a request for `requestName`. Optionally pass arguments to send along to the callback. Returns the reply, if one | ||
##### `reply( requestName, callback [, context] )` | ||
#### `reply( requestName, callback [, context] )` | ||
@@ -326,3 +324,3 @@ Register a handler for `requestName` on this object. `callback` will be executed whenever the request is made. Optionally | ||
##### `replyOnce( requestName, callback [, context] )` | ||
#### `replyOnce( requestName, callback [, context] )` | ||
@@ -336,3 +334,3 @@ Register a handler for `requestName` that will only be called a single time. | ||
##### `stopReplying( [requestName] )` | ||
#### `stopReplying( [requestName] )` | ||
@@ -347,7 +345,7 @@ If `requestName` is passed then this method will remove that reply. Otherwise, all replies are removed from the object. | ||
##### `channelName` | ||
#### `channelName` | ||
The name of the channel. | ||
##### `reset()` | ||
#### `reset()` | ||
@@ -358,3 +356,3 @@ Destroy all handlers from Backbone.Events, Radio.Commands, and Radio.Requests from the channel. Returns the channel. | ||
##### `channel( channelName )` | ||
#### `channel( channelName )` | ||
@@ -364,6 +362,6 @@ Get a reference to a channel by name. If a name is not provided an Error will be thrown. | ||
```js | ||
var globalChannel = Backbone.Radio.channel('hello'); | ||
var authChannel = Backbone.Radio.channel('auth'); | ||
``` | ||
##### `DEBUG` | ||
#### `DEBUG` | ||
@@ -385,3 +383,3 @@ This is a Boolean property. Setting it to `true` will cause console warnings to be issued | ||
##### `tuneIn( channelName )` | ||
#### `tuneIn( channelName )` | ||
@@ -398,3 +396,3 @@ Tuning into a Channel is another useful tool for debugging. It passes all | ||
##### `tuneOut( channelName )` | ||
#### `tuneOut( channelName )` | ||
@@ -407,3 +405,3 @@ Once you're done tuning in you can call `tuneOut` to stop the logging. Returns `Backbone.Radio`. | ||
##### `log( channelName, eventName [, args...] )` | ||
#### `log( channelName, eventName [, args...] )` | ||
@@ -426,6 +424,6 @@ When tuned into a Channel, this method will be called for all activity on | ||
```js | ||
// Trigger 'some:event' on the global channel | ||
Backbone.Radio.trigger('global', 'some:event'); | ||
// Trigger 'some:event' on the settings channel | ||
Backbone.Radio.trigger('settings', 'some:event'); | ||
``` | ||
All of the methods for all three messaging systems are available from the top-level API. |
111647
412
+ Addedunderscore@1.7.0(transitive)
- Removedunderscore@1.6.0(transitive)
Updatedunderscore@>=1.6.0 <=1.7.0