Skip to content

Instantly share code, notes, and snippets.

@jamiebuilds
Last active October 5, 2016 15:29
Show Gist options
  • Save jamiebuilds/48afb443b8c8c6ee4f46 to your computer and use it in GitHub Desktop.
Save jamiebuilds/48afb443b8c8c6ee4f46 to your computer and use it in GitHub Desktop.
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['backbone.marionette', 'backbone.radio', 'underscore'], factory);
} else if (typeof exports !== 'undefined') {
module.exports = factory(require('backbone.marionette'), require('backbone.radio'), require('underscore'));
} 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);
}
}));
@chrisslater
Copy link

Really helpful for general crossover npm/amd setup, thanks!

@matiux
Copy link

matiux commented Aug 30, 2015

Uhm... how to use this code?

@Seebiscuit
Copy link

@thejameskyle is there any downside to using marionette instead of backbone.marionette in the define (since I like to use marionette in my RequireJS config)?

define(['marionette', 'backbone.radio', 'underscore'], factory);

@dmackerman
Copy link

dmackerman commented Oct 5, 2016

@matiux (With Webpack) just import it. import 'lib/radio.shim.js';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment