Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can ampersand-events be used in place of Backbone.Events? #9

Closed
dschissler opened this issue Jul 10, 2015 · 6 comments
Closed

Can ampersand-events be used in place of Backbone.Events? #9

dschissler opened this issue Jul 10, 2015 · 6 comments

Comments

@dschissler
Copy link

I'm considering using all Ampersand modules and creating a fake backbone module with the following so that I can use backbone.radio.

module.exports = {
    Events: require('ampersand-events')
}

Will this work?

@latentflip
Copy link
Contributor

It's pretty similar to Backbone.Events and so should support the same methods.

Have you tried it?

@dschissler
Copy link
Author

No but I'm near to doing it. It will take me some hours to convert my Marionette R&D skeleton to Ampersand (to port some old pure Backbone code). I'm considering just using Events.createEmitter() since I don't think that I need multiple channels.

@getdave
Copy link

getdave commented Jul 22, 2015

@dschissler did you ever use Radio with ampersand?

@dschissler
Copy link
Author

No. I might try that soon since my code has settled down a bit since all of the structure is ampersand now. I'll let you know about that.

@getdave
Copy link

getdave commented Jul 23, 2015

@dschissler That would be great. I really like Backbone Radio and so being able to utilise with Ampersand would be a big win.

@dschissler
Copy link
Author

@getdave Sorry for the long delay. The backend took a long time. So far it seems to be wiring up well with:

backbone_shim user module

'use strict';
import Events from 'ampersand-events';

export default {
  Events: Events
}

webpack config

    alias: {
      underscore: 'lodash',
      backbone: 'backbone_shim',
      ...
    },

globalCh user module

'use strict';
import Radio from 'backbone.radio';

export default Radio.channel('global');

I think that its best to use a globalCh module because you can wire it up with different libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants