Created
June 5, 2016 00:44
-
-
Save jonathanccalixto/4a94e979e17f1e365ef8aabff025e9d8 to your computer and use it in GitHub Desktop.
A shim to replace Backbone.Wreqr with Backbone.Radio in Marionette. Requires Marionette v2.1+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
define(['backbone.marionette', 'backbone.radio', 'underscore'], function(Marionette, Radio, _) { | |
return factory(Marionette, Radio, _); | |
}); | |
} | |
else if (typeof exports !== 'undefined') { | |
var Marionette = require('backbone.marionette'); | |
var Radio = require('backbone.radio'); | |
var _ = require('underscore'); | |
module.exports = factory(Marionette, Radio, _); | |
} | |
else { | |
factory(root.Backbone.Marionette, root.Backbone.Radio, root._); | |
} | |
}(this, function(Marionette, Radio, _) { | |
'use strict'; | |
Marionette.Application.prototype._initChannel = function () { | |
this.channelName = _.result(this, 'channelName') || 'global'; | |
this.channel = _.result(this, 'channel') || Radio.channel(this.channelName); | |
} | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment