Maluen/Backbone-Debugger

Hanging at "Waiting for Backbone..."

bard opened this issue · 3 comments

bard commented

I tried to use the Backbone Debugger on prose.io but reloading the app in debug mode leads to a "Waiting for Backbone..." message hanging there indefinitely.

What are the conditions that the debugger waits for? I'm not familiar with Backbone but I'd like to give a shot at making Prose behave well with the debugger.

Backbone can't be found since you are using webpack or a similar module system, I'm updating the debugger code to allow manual detection of Backbone by inserting a code snippet.

The snippet will have to be inserted just after Backbone has been required in the main file, but before any other view, model, etc. has been created.

The snippet is the following, please try it and tell me if it works for you:

if (window.__backboneAgent) {
  window.__backboneAgent.handleBackbone(Backbone);
}

Assuming that right before it you have something like

var Backbone = require('Backbone');

This has to be tested by using the latest master branch code.

bard commented

Excellent, simply exposing Backbone in the window scope unlocks the debugger. I'll propose the change upstream.

Thanks!