backbone_inspector
backbone_inspector copied to clipboard
Remove requirement to edit core Backbone View
Right now the extension requires editing the core Backbone.View library to add in extra functionality for tracking Views.
Obviously this isn't great, and is only being done right now as a proof of concept.
Could:
- include a new View class to extend from in your application
- include a script to include in your application which monkey-patches in the required functionality
- include monkey-patch script with the extension and auto-load it, but likely won't work with AMD applications
Why not just augment Backbone.View#_configure to track the View's automatically? Just transparently drop in and call super. I can assist with this. Ideally this works out-of-the-box and doesn't require the developer to augment their code to support the developer tool.
As for finding Backbone, I'm writing a somewhat intelligent script to try and detect it. Perhaps as a fallback expose a global method that the end user can trigger with the Backbone instance immediately after loading (in case they are using noConflict to remove the implied global)?
Yeah, it was a plan to monkey-patch into Backbone.View's initialisation methods, the only issue is finding Backbone if it's not in the global namespace; but if you have something in the works, hit me up?
I'm going to get a branch going for monkey-patching into window.Backbone.View if it exists for now.
https://github.com/danharper/backbone_inspector/tree/injection
I'm having a few issues with running the code correctly on the main window from the extension. Either I'm tired, or I'm missing something in the docs. So for now I've just got the code to be injected (overriding the _configure).