Auto reloading browser view


there is a possibility of browser preview in Komodo Edit. I use internal Komodo browser and I would like to have this browser preview updated on each file save. I have found this script here:

var views = ko.views.manager.getAllViews();
var view;
for (var i=0; i < views.length; i++) {
    view = views[i];
    if (view.getAttribute("type") == "browser") {

After attaching this macro to Komodo event “file save” it works perfectly, when the browser preview is in the same tab-bar as the edited files. However, it does not work when I use Split View feature and the browser tab is in another tab-bar. I would like to know how to modify the script to get the desired behavior. I also attach the screenshot to for better understanding of my question.

Thanks in advance for any help.

I’ve tried the macro on both OSX and Linux but am not able to reproduce your issue. Are you sure the browser is not reloading? To verify try using the following address and see if the timestamp changes:

1 Like

Try using this:

var views = ko.views.manager.topView.getViewsByType(true, 'browser');

as when using split view - the getAllViews method just returns those in the current split view… these APIs need some work :stuck_out_tongue:

1 Like

toddw: The modified script seems to be working.

all: I did some additional testing with the original script in the meantime, before the toddw’s reply appeared. I’ve found out, that the original script works as long as split view is not used. When the split view is used, it works as long as all the file tabs are in the left-hand-side pane and the browser tab on the right-hand-side. And it does not work exactly in that layout that can be seen on the screenshot above (without the blue line of course).

Anyway, the script modification seems to solve this issue and it seems to work in all cases. Thanks a lot to you both!

That seems pretty much in-line with what @toddw was saying (getAllViews() only considers one half of the split).