yano-backbone-rails 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e01ca61ba08d96dbaf3ce01c5a572c40203b3f0
4
- data.tar.gz: ea199f063c5491a40737230acb41ec4f931199c5
3
+ metadata.gz: 6adfc034b80840615954655e9ce474715ab276ca
4
+ data.tar.gz: 930d60c8ac824a173bbbc81243e02c28f65b9006
5
5
  SHA512:
6
- metadata.gz: 6f7ac21aeffb87d6b49d9b9fadc9bd76cf169df09211adc85811c83720277644c9dd13a5000262e481cdb61ef0af669ee3069e10ab2b46bfceda8be50e68f2c8
7
- data.tar.gz: d1701a31e378a09f138e820b70901abde54f224da8e7224f9a18f5c293a1f834f8160407d07d6bbabccf67d626b7e82273179764e382ba7613174866683f84ba
6
+ metadata.gz: 9fdc21193975c7f9e933db17b9a6dae88d7d6be6d31aa3bec378d8a8e13e267606fc1f4df5cd2b23bff6943dea5bb6810037146771b5bfd72bd07fe06c959b0c
7
+ data.tar.gz: 406daea88dfd21194a8a67c43866737b912f6bad4ba9d9a2432438776b2d83199bc33abb8537710745572286075be2839041ed9e24b89f26de4100138d359ad7
data/Rakefile CHANGED
@@ -199,8 +199,8 @@ namespace :update do
199
199
  puts "Downloading #{filename}.map"
200
200
  puts "mkdir -p ./source_maps"
201
201
  puts `mkdir -p ./source_maps`
202
- puts "curl -o ./source_maps/#{filename}.map https://raw.githubusercontent.com/marionettejs/backbone.babysitter/v#{version}/lib/#{filename}.map"
203
- puts `curl -o ./source_maps/#{filename}.map https://raw.githubusercontent.com/marionettejs/backbone.babysitter/v#{version}/lib/#{filename}.map`
202
+ puts "curl -o ./source_maps/#{filename}.map https://raw.githubusercontent.com/marionettejs/backbone.radio/v#{version}/build/#{filename}.map"
203
+ puts `curl -o ./source_maps/#{filename}.map https://raw.githubusercontent.com/marionettejs/backbone.radio/v#{version}/build/#{filename}.map`
204
204
  end
205
205
  end
206
206
  end
@@ -1,7 +1,7 @@
1
1
  module Yano
2
2
  module Backbone
3
3
  module Rails
4
- VERSION = "1.0.2"
4
+ VERSION = "1.0.3"
5
5
  UNDERSCORE_VERSION = "1.8.3"
6
6
  BACKBONE_VERSION = "1.3.3"
7
7
  MARIONETTE_VERSION = "2.4.7"
@@ -1 +1 @@
1
- Not Found
1
+ {"version":3,"names":[],"mappings":"","sources":["backbone.radio.js"],"sourcesContent":["// Backbone.Radio v1.0.4\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('underscore'), require('backbone')) :\n typeof define === 'function' && define.amd ? define(['underscore', 'backbone'], factory) :\n (global.Backbone = global.Backbone || {}, global.Backbone.Radio = factory(global._,global.Backbone));\n}(this, function (_,Backbone) { 'use strict';\n\n _ = 'default' in _ ? _['default'] : _;\n Backbone = 'default' in Backbone ? Backbone['default'] : Backbone;\n\n var babelHelpers = {};\n babelHelpers.typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n };\n babelHelpers;\n\n var previousRadio = Backbone.Radio;\n\n var Radio = Backbone.Radio = {};\n\n Radio.VERSION = '1.0.4';\n\n // This allows you to run multiple instances of Radio on the same\n // webapp. After loading the new version, call `noConflict()` to\n // get a reference to it. At the same time the old version will be\n // returned to Backbone.Radio.\n Radio.noConflict = function () {\n Backbone.Radio = previousRadio;\n return this;\n };\n\n // Whether or not we're in DEBUG mode or not. DEBUG mode helps you\n // get around the issues of lack of warnings when events are mis-typed.\n Radio.DEBUG = false;\n\n // Format debug text.\n Radio._debugText = function (warning, eventName, channelName) {\n return warning + (channelName ? ' on the ' + channelName + ' channel' : '') + ': \"' + eventName + '\"';\n };\n\n // This is the method that's called when an unregistered event was called.\n // By default, it logs warning to the console. By overriding this you could\n // make it throw an Error, for instance. This would make firing a nonexistent event\n // have the same consequence as firing a nonexistent method on an Object.\n Radio.debugLog = function (warning, eventName, channelName) {\n if (Radio.DEBUG && console && console.warn) {\n console.warn(Radio._debugText(warning, eventName, channelName));\n }\n };\n\n var eventSplitter = /\\s+/;\n\n // An internal method used to handle Radio's method overloading for Requests.\n // It's borrowed from Backbone.Events. It differs from Backbone's overload\n // API (which is used in Backbone.Events) in that it doesn't support space-separated\n // event names.\n Radio._eventsApi = function (obj, action, name, rest) {\n if (!name) {\n return false;\n }\n\n var results = {};\n\n // Handle event maps.\n if ((typeof name === 'undefined' ? 'undefined' : babelHelpers.typeof(name)) === 'object') {\n for (var key in name) {\n var result = obj[action].apply(obj, [key, name[key]].concat(rest));\n eventSplitter.test(key) ? _.extend(results, result) : results[key] = result;\n }\n return results;\n }\n\n // Handle space separated event names.\n if (eventSplitter.test(name)) {\n var names = name.split(eventSplitter);\n for (var i = 0, l = names.length; i < l; i++) {\n results[names[i]] = obj[action].apply(obj, [names[i]].concat(rest));\n }\n return results;\n }\n\n return false;\n };\n\n // An optimized way to execute callbacks.\n Radio._callHandler = function (callback, context, args) {\n var a1 = args[0],\n a2 = args[1],\n a3 = args[2];\n switch (args.length) {\n case 0:\n return callback.call(context);\n case 1:\n return callback.call(context, a1);\n case 2:\n return callback.call(context, a1, a2);\n case 3:\n return callback.call(context, a1, a2, a3);\n default:\n return callback.apply(context, args);\n }\n };\n\n // A helper used by `off` methods to the handler from the store\n function removeHandler(store, name, callback, context) {\n var event = store[name];\n if ((!callback || callback === event.callback || callback === event.callback._callback) && (!context || context === event.context)) {\n delete store[name];\n return true;\n }\n }\n\n function removeHandlers(store, name, callback, context) {\n store || (store = {});\n var names = name ? [name] : _.keys(store);\n var matched = false;\n\n for (var i = 0, length = names.length; i < length; i++) {\n name = names[i];\n\n // If there's no event by this name, log it and continue\n // with the loop\n if (!store[name]) {\n continue;\n }\n\n if (removeHandler(store, name, callback, context)) {\n matched = true;\n }\n }\n\n return matched;\n }\n\n /*\n * tune-in\n * -------\n * Get console logs of a channel's activity\n *\n */\n\n var _logs = {};\n\n // This is to produce an identical function in both tuneIn and tuneOut,\n // so that Backbone.Events unregisters it.\n function _partial(channelName) {\n return _logs[channelName] || (_logs[channelName] = _.bind(Radio.log, Radio, channelName));\n }\n\n _.extend(Radio, {\n\n // Log information about the channel and event\n log: function log(channelName, eventName) {\n if (typeof console === 'undefined') {\n return;\n }\n var args = _.toArray(arguments).slice(2);\n console.log('[' + channelName + '] \"' + eventName + '\"', args);\n },\n\n // Logs all events on this channel to the console. It sets an\n // internal value on the channel telling it we're listening,\n // then sets a listener on the Backbone.Events\n tuneIn: function tuneIn(channelName) {\n var channel = Radio.channel(channelName);\n channel._tunedIn = true;\n channel.on('all', _partial(channelName));\n return this;\n },\n\n // Stop logging all of the activities on this channel to the console\n tuneOut: function tuneOut(channelName) {\n var channel = Radio.channel(channelName);\n channel._tunedIn = false;\n channel.off('all', _partial(channelName));\n delete _logs[channelName];\n return this;\n }\n });\n\n /*\n * Backbone.Radio.Requests\n * -----------------------\n * A messaging system for requesting data.\n *\n */\n\n function makeCallback(callback) {\n return _.isFunction(callback) ? callback : function () {\n return callback;\n };\n }\n\n Radio.Requests = {\n\n // Make a request\n request: function request(name) {\n var args = _.toArray(arguments).slice(1);\n var results = Radio._eventsApi(this, 'request', name, args);\n if (results) {\n return results;\n }\n var channelName = this.channelName;\n var requests = this._requests;\n\n // Check if we should log the request, and if so, do it\n if (channelName && this._tunedIn) {\n Radio.log.apply(this, [channelName, name].concat(args));\n }\n\n // If the request isn't handled, log it in DEBUG mode and exit\n if (requests && (requests[name] || requests['default'])) {\n var handler = requests[name] || requests['default'];\n args = requests[name] ? args : arguments;\n return Radio._callHandler(handler.callback, handler.context, args);\n } else {\n Radio.debugLog('An unhandled request was fired', name, channelName);\n }\n },\n\n // Set up a handler for a request\n reply: function reply(name, callback, context) {\n if (Radio._eventsApi(this, 'reply', name, [callback, context])) {\n return this;\n }\n\n this._requests || (this._requests = {});\n\n if (this._requests[name]) {\n Radio.debugLog('A request was overwritten', name, this.channelName);\n }\n\n this._requests[name] = {\n callback: makeCallback(callback),\n context: context || this\n };\n\n return this;\n },\n\n // Set up a handler that can only be requested once\n replyOnce: function replyOnce(name, callback, context) {\n if (Radio._eventsApi(this, 'replyOnce', name, [callback, context])) {\n return this;\n }\n\n var self = this;\n\n var once = _.once(function () {\n self.stopReplying(name);\n return makeCallback(callback).apply(this, arguments);\n });\n\n return this.reply(name, once, context);\n },\n\n // Remove handler(s)\n stopReplying: function stopReplying(name, callback, context) {\n if (Radio._eventsApi(this, 'stopReplying', name)) {\n return this;\n }\n\n // Remove everything if there are no arguments passed\n if (!name && !callback && !context) {\n delete this._requests;\n } else if (!removeHandlers(this._requests, name, callback, context)) {\n Radio.debugLog('Attempted to remove the unregistered request', name, this.channelName);\n }\n\n return this;\n }\n };\n\n /*\n * Backbone.Radio.channel\n * ----------------------\n * Get a reference to a channel by name.\n *\n */\n\n Radio._channels = {};\n\n Radio.channel = function (channelName) {\n if (!channelName) {\n throw new Error('You must provide a name for the channel.');\n }\n\n if (Radio._channels[channelName]) {\n return Radio._channels[channelName];\n } else {\n return Radio._channels[channelName] = new Radio.Channel(channelName);\n }\n };\n\n /*\n * Backbone.Radio.Channel\n * ----------------------\n * A Channel is an object that extends from Backbone.Events,\n * and Radio.Requests.\n *\n */\n\n Radio.Channel = function (channelName) {\n this.channelName = channelName;\n };\n\n _.extend(Radio.Channel.prototype, Backbone.Events, Radio.Requests, {\n\n // Remove all handlers from the messaging systems of this channel\n reset: function reset() {\n this.off();\n this.stopListening();\n this.stopReplying();\n return this;\n }\n });\n\n /*\n * Top-level API\n * -------------\n * Supplies the 'top-level API' for working with Channels directly\n * from Backbone.Radio.\n *\n */\n\n var channel;\n var args;\n var systems = [Backbone.Events, Radio.Requests];\n _.each(systems, function (system) {\n _.each(system, function (method, methodName) {\n Radio[methodName] = function (channelName) {\n args = _.toArray(arguments).slice(1);\n channel = this.channel(channelName);\n return channel[methodName].apply(channel, args);\n };\n });\n });\n\n Radio.reset = function (channelName) {\n var channels = !channelName ? this._channels : [this._channels[channelName]];\n _.each(channels, function (channel) {\n channel.reset();\n });\n };\n\n return Radio;\n\n}));\n"],"file":"backbone.radio.js","sourceRoot":"/source/"}
@@ -1 +1,2 @@
1
- Not Found
1
+ // Backbone.Radio v1.0.4
2
+ {"version":3,"sources":["backbone.radio.min.js"],"names":["global","factory","exports","module","require","define","amd","Backbone","Radio","_","this","removeHandler","store","name","callback","context","event","_callback","removeHandlers","names","keys","matched","i","length","_partial","channelName","_logs","bind","log","makeCallback","isFunction","babelHelpers","Symbol","iterator","obj","constructor","previousRadio","VERSION","noConflict","DEBUG","_debugText","warning","eventName","debugLog","console","warn","eventSplitter","_eventsApi","action","rest","results","key","result","apply","concat","test","extend","split","l","_callHandler","args","a1","a2","a3","call","toArray","arguments","slice","tuneIn","channel","_tunedIn","on","tuneOut","off","Requests","request","requests","_requests","handler","reply","replyOnce","self","once","stopReplying","_channels","Error","Channel","prototype","Events","reset","stopListening","systems","each","system","method","methodName","channels"],"mappings":"CAEC,SAAUA,EAAQC,GACE,gBAAZC,UAA0C,mBAAXC,QAAyBA,OAAOD,QAAUD,EAAQG,QAAQ,cAAeA,QAAQ,aACrG,kBAAXC,SAAyBA,OAAOC,IAAMD,QAAQ,aAAc,YAAaJ,IAC/ED,EAAOO,SAAWP,EAAOO,aAAgBP,EAAOO,SAASC,MAAQP,EAAQD,EAAOS,EAAET,EAAOO,YAC1FG,KAAM,SAAUD,EAAEF,GAAY,YAqG9B,SAASI,GAAcC,EAAOC,EAAMC,EAAUC,GAC5C,GAAIC,GAAQJ,EAAMC,EAClB,OAAMC,IAAYA,IAAaE,EAAMF,UAAYA,IAAaE,EAAMF,SAASG,WAAgBF,GAAWA,IAAYC,EAAMD,QAA1H,cACSH,GAAMC,IACN,GAIX,QAASK,GAAeN,EAAOC,EAAMC,EAAUC,GAC7CH,IAAU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MAAMlE,EAAMqE,EAAMnE,IAIhCoE,aAAc,SAAsBtE,EAAMC,EAAUC,GAClD,MAAIP,GAAMuC,WAAWrC,KAAM,eAAgBG,GAClCH,MAIJG,GAASC,GAAaC,EAEfG,EAAeR,KAAKmE,UAAWhE,EAAMC,EAAUC,IACzDP,EAAMmC,SAAS,+CAAgD9B,EAAMH,KAAKe,mBAFnEf,MAAKmE,UAKPnE,QAWXF,EAAM4E,aAEN5E,EAAM6D,QAAU,SAAU5C,GACxB,IAAKA,EACH,KAAM,IAAI4D,OAAM,2CAGlB,OAAI7E,GAAM4E,UAAU3D,GACXjB,EAAM4E,UAAU3D,GAEhBjB,EAAM4E,UAAU3D,GAAe,GAAIjB,GAAM8E,QAAQ7D,IAY5DjB,EAAM8E,QAAU,SAAU7D,GACxBf,KAAKe,YAAcA,GAGrBhB,EAAE+C,OAAOhD,EAAM8E,QAAQC,UAAWhF,EAASiF,OAAQhF,EAAMkE,UAGvDe,MAAO,WAIL,MAHA/E,MAAK+D,MACL/D,KAAKgF,gBACLhF,KAAKyE,eACEzE,OAYX,IAAI2D,GACAT,EACA+B,GAAWpF,EAASiF,OAAQhF,EAAMkE,SAkBtC,OAjBAjE,GAAEmF,KAAKD,EAAS,SAAUE,GACxBpF,EAAEmF,KAAKC,EAAQ,SAAUC,EAAQC,GAC/BvF,EAAMuF,GAAc,SAAUtE,GAG5B,MAFAmC,GAAOnD,EAAEwD,QAAQC,WAAWC,MAAM,GAClCE,EAAU3D,KAAK2D,QAAQ5C,GAChB4C,EAAQ0B,GAAY1C,MAAMgB,EAAST,QAKhDpD,EAAMiF,MAAQ,SAAUhE,GACtB,GAAIuE,GAAYvE,GAAgCf,KAAK0E,UAAU3D,IAAjCf,KAAK0E,SACnC3E,GAAEmF,KAAKI,EAAU,SAAU3B,GACzBA,EAAQoB,WAILjF","file":"backbone.radio.min.js","sourcesContent":["// Backbone.Radio v1.0.4\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('underscore'), require('backbone')) :\n typeof define === 'function' && define.amd ? define(['underscore', 'backbone'], factory) :\n (global.Backbone = global.Backbone || {}, global.Backbone.Radio = factory(global._,global.Backbone));\n}(this, function (_,Backbone) { 'use strict';\n\n _ = 'default' in _ ? _['default'] : _;\n Backbone = 'default' in Backbone ? Backbone['default'] : Backbone;\n\n var babelHelpers = {};\n babelHelpers.typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n };\n babelHelpers;\n\n var previousRadio = Backbone.Radio;\n\n var Radio = Backbone.Radio = {};\n\n Radio.VERSION = '1.0.4';\n\n // This allows you to run multiple instances of Radio on the same\n // webapp. After loading the new version, call `noConflict()` to\n // get a reference to it. At the same time the old version will be\n // returned to Backbone.Radio.\n Radio.noConflict = function () {\n Backbone.Radio = previousRadio;\n return this;\n };\n\n // Whether or not we're in DEBUG mode or not. DEBUG mode helps you\n // get around the issues of lack of warnings when events are mis-typed.\n Radio.DEBUG = false;\n\n // Format debug text.\n Radio._debugText = function (warning, eventName, channelName) {\n return warning + (channelName ? ' on the ' + channelName + ' channel' : '') + ': \"' + eventName + '\"';\n };\n\n // This is the method that's called when an unregistered event was called.\n // By default, it logs warning to the console. By overriding this you could\n // make it throw an Error, for instance. This would make firing a nonexistent event\n // have the same consequence as firing a nonexistent method on an Object.\n Radio.debugLog = function (warning, eventName, channelName) {\n if (Radio.DEBUG && console && console.warn) {\n console.warn(Radio._debugText(warning, eventName, channelName));\n }\n };\n\n var eventSplitter = /\\s+/;\n\n // An internal method used to handle Radio's method overloading for Requests.\n // It's borrowed from Backbone.Events. It differs from Backbone's overload\n // API (which is used in Backbone.Events) in that it doesn't support space-separated\n // event names.\n Radio._eventsApi = function (obj, action, name, rest) {\n if (!name) {\n return false;\n }\n\n var results = {};\n\n // Handle event maps.\n if ((typeof name === 'undefined' ? 'undefined' : babelHelpers.typeof(name)) === 'object') {\n for (var key in name) {\n var result = obj[action].apply(obj, [key, name[key]].concat(rest));\n eventSplitter.test(key) ? _.extend(results, result) : results[key] = result;\n }\n return results;\n }\n\n // Handle space separated event names.\n if (eventSplitter.test(name)) {\n var names = name.split(eventSplitter);\n for (var i = 0, l = names.length; i < l; i++) {\n results[names[i]] = obj[action].apply(obj, [names[i]].concat(rest));\n }\n return results;\n }\n\n return false;\n };\n\n // An optimized way to execute callbacks.\n Radio._callHandler = function (callback, context, args) {\n var a1 = args[0],\n a2 = args[1],\n a3 = args[2];\n switch (args.length) {\n case 0:\n return callback.call(context);\n case 1:\n return callback.call(context, a1);\n case 2:\n return callback.call(context, a1, a2);\n case 3:\n return callback.call(context, a1, a2, a3);\n default:\n return callback.apply(context, args);\n }\n };\n\n // A helper used by `off` methods to the handler from the store\n function removeHandler(store, name, callback, context) {\n var event = store[name];\n if ((!callback || callback === event.callback || callback === event.callback._callback) && (!context || context === event.context)) {\n delete store[name];\n return true;\n }\n }\n\n function removeHandlers(store, name, callback, context) {\n store || (store = {});\n var names = name ? [name] : _.keys(store);\n var matched = false;\n\n for (var i = 0, length = names.length; i < length; i++) {\n name = names[i];\n\n // If there's no event by this name, log it and continue\n // with the loop\n if (!store[name]) {\n continue;\n }\n\n if (removeHandler(store, name, callback, context)) {\n matched = true;\n }\n }\n\n return matched;\n }\n\n /*\n * tune-in\n * -------\n * Get console logs of a channel's activity\n *\n */\n\n var _logs = {};\n\n // This is to produce an identical function in both tuneIn and tuneOut,\n // so that Backbone.Events unregisters it.\n function _partial(channelName) {\n return _logs[channelName] || (_logs[channelName] = _.bind(Radio.log, Radio, channelName));\n }\n\n _.extend(Radio, {\n\n // Log information about the channel and event\n log: function log(channelName, eventName) {\n if (typeof console === 'undefined') {\n return;\n }\n var args = _.toArray(arguments).slice(2);\n console.log('[' + channelName + '] \"' + eventName + '\"', args);\n },\n\n // Logs all events on this channel to the console. It sets an\n // internal value on the channel telling it we're listening,\n // then sets a listener on the Backbone.Events\n tuneIn: function tuneIn(channelName) {\n var channel = Radio.channel(channelName);\n channel._tunedIn = true;\n channel.on('all', _partial(channelName));\n return this;\n },\n\n // Stop logging all of the activities on this channel to the console\n tuneOut: function tuneOut(channelName) {\n var channel = Radio.channel(channelName);\n channel._tunedIn = false;\n channel.off('all', _partial(channelName));\n delete _logs[channelName];\n return this;\n }\n });\n\n /*\n * Backbone.Radio.Requests\n * -----------------------\n * A messaging system for requesting data.\n *\n */\n\n function makeCallback(callback) {\n return _.isFunction(callback) ? callback : function () {\n return callback;\n };\n }\n\n Radio.Requests = {\n\n // Make a request\n request: function request(name) {\n var args = _.toArray(arguments).slice(1);\n var results = Radio._eventsApi(this, 'request', name, args);\n if (results) {\n return results;\n }\n var channelName = this.channelName;\n var requests = this._requests;\n\n // Check if we should log the request, and if so, do it\n if (channelName && this._tunedIn) {\n Radio.log.apply(this, [channelName, name].concat(args));\n }\n\n // If the request isn't handled, log it in DEBUG mode and exit\n if (requests && (requests[name] || requests['default'])) {\n var handler = requests[name] || requests['default'];\n args = requests[name] ? args : arguments;\n return Radio._callHandler(handler.callback, handler.context, args);\n } else {\n Radio.debugLog('An unhandled request was fired', name, channelName);\n }\n },\n\n // Set up a handler for a request\n reply: function reply(name, callback, context) {\n if (Radio._eventsApi(this, 'reply', name, [callback, context])) {\n return this;\n }\n\n this._requests || (this._requests = {});\n\n if (this._requests[name]) {\n Radio.debugLog('A request was overwritten', name, this.channelName);\n }\n\n this._requests[name] = {\n callback: makeCallback(callback),\n context: context || this\n };\n\n return this;\n },\n\n // Set up a handler that can only be requested once\n replyOnce: function replyOnce(name, callback, context) {\n if (Radio._eventsApi(this, 'replyOnce', name, [callback, context])) {\n return this;\n }\n\n var self = this;\n\n var once = _.once(function () {\n self.stopReplying(name);\n return makeCallback(callback).apply(this, arguments);\n });\n\n return this.reply(name, once, context);\n },\n\n // Remove handler(s)\n stopReplying: function stopReplying(name, callback, context) {\n if (Radio._eventsApi(this, 'stopReplying', name)) {\n return this;\n }\n\n // Remove everything if there are no arguments passed\n if (!name && !callback && !context) {\n delete this._requests;\n } else if (!removeHandlers(this._requests, name, callback, context)) {\n Radio.debugLog('Attempted to remove the unregistered request', name, this.channelName);\n }\n\n return this;\n }\n };\n\n /*\n * Backbone.Radio.channel\n * ----------------------\n * Get a reference to a channel by name.\n *\n */\n\n Radio._channels = {};\n\n Radio.channel = function (channelName) {\n if (!channelName) {\n throw new Error('You must provide a name for the channel.');\n }\n\n if (Radio._channels[channelName]) {\n return Radio._channels[channelName];\n } else {\n return Radio._channels[channelName] = new Radio.Channel(channelName);\n }\n };\n\n /*\n * Backbone.Radio.Channel\n * ----------------------\n * A Channel is an object that extends from Backbone.Events,\n * and Radio.Requests.\n *\n */\n\n Radio.Channel = function (channelName) {\n this.channelName = channelName;\n };\n\n _.extend(Radio.Channel.prototype, Backbone.Events, Radio.Requests, {\n\n // Remove all handlers from the messaging systems of this channel\n reset: function reset() {\n this.off();\n this.stopListening();\n this.stopReplying();\n return this;\n }\n });\n\n /*\n * Top-level API\n * -------------\n * Supplies the 'top-level API' for working with Channels directly\n * from Backbone.Radio.\n *\n */\n\n var channel;\n var args;\n var systems = [Backbone.Events, Radio.Requests];\n _.each(systems, function (system) {\n _.each(system, function (method, methodName) {\n Radio[methodName] = function (channelName) {\n args = _.toArray(arguments).slice(1);\n channel = this.channel(channelName);\n return channel[methodName].apply(channel, args);\n };\n });\n });\n\n Radio.reset = function (channelName) {\n var channels = !channelName ? this._channels : [this._channels[channelName]];\n _.each(channels, function (channel) {\n channel.reset();\n });\n };\n\n return Radio;\n\n}));\n//# sourceMappingURL=./backbone.radio.js.map"],"sourceRoot":"/source/"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yano-backbone-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan C. Calixto