Maluen/Backbone-Debugger

Question: Does Backbone need to be a global for this plugin to work?

michaelBenin opened this issue · 5 comments

If it does, there should be some documentation for commonjs users.

var Backbone = require('backbone');
window.Backbone = Backbone;

Actually right now we have two methods of detecting Backbone:

  1. window.Backbone: i.e. when it is defined in the global object
  2. AMD: for this though, window.define must be set, i.e. "define" must be in the global object.

Either way, the global object is used, even if in different ways.

As for CommonJS, yes it isn't supported for now, but I've some ideas in using the Chrome ScriptPreprocessor that allows devtools extensions to change on the fly the javascript code before it is executed.

With it we could search for Backbone in the code and change it accordingly to automatically do what instead the user would have to do manually to make the debug running, i.e. calling a function of the extension passing to it the Backbone object.

For this reason, I'm not very sure in creating documentation about this, we can probably reach CommonJS and any other module loader support without caveats with some work.

Should I remove question from this issue?

Of course not, is still a question! ;)

I've even added the "question" label

Is there an issue for commonjs support?

Nope, but would be awesome if you could create it