Having decided to write a plugin I next had to work out what the plugin would be for and I settled on KnockoutJS. While I’ll admit that I’ve had a love-hate relationship with Knockout the problem space it’s in is very real and it does solve it very well, but when you have Knockout on a page it can be very difficult to work out where you’re actually using it and what’s actually happening in it.
To that end I’ve started a Glimpse KnockoutJS plugin. It’s still in its early days (and I’d love feedback hint hint) but so far what it aims to do is:
- Show you what ViewModels are on a page and what DOM element(s) they are bound to
- The idea here is that you can see if a ViewModel is reused across multiple DOM elements
- Capture new ViewModels being added to the page and show them in the plugin
- This can be handy if you’re creating ViewModels in popups or from Ajax requests
- Show you the properties of the ViewModels, and if they are observable properties track their changes
- This should work for any kind of observable, be it a simple observable, an observable array or a computed observable
Like I said this is a very early release, but it’s more I wanted it out there and to get feedback ASAP to work out what to focus on. I’ve only done some basic testing so if you’re using it on large Knockout VM’s I’d like to hear how it goes.
The code is all up on GitHub so feel free to send PR’s or raise issues so I can get to work on it!