[TxMt] Re: how does the html bundle preview a document with unsaved changes?

Stephen Bannasch stephen.bannasch at deanbrook.org
Fri Sep 13 12:17:59 UTC 2013


At 11:22 PM +0200 9/11/13, Allan Odgaard wrote:
>On 11 Sep 2013, at 1:13, Stephen Bannasch wrote:
>
>>[Š] When it is invoked and there are no errors it executes this in nodejs:
>>[Š] This is of course not perfect ... but it seems to be good enough.
>
>In theory you can use 'window.close()' to close windows (from JavaScript).
>
>In practice there is a bug in WebKit so that this only works the 
>first time a WebView instance gets closed, meaning that if the view 
>is re-used (which they generally are), it will not react to the 
>close function the second time.
>
>I'm looking into adding a workaround (so WebViews are not re-used 
>when the close function has been used).

Most of the time the common use pattern for using the jshint.tmbundle 
for checking/correcting is that the jshint function is invoked on the 
current doc ... and may be done repeatedly.

However it also possible now to invoke it on one doc, generate and 
error window, and invoke on a separate doc and generate a second 
error window. If you then switch back to the first document and 
resolve all the errors the first error window will close.

This should work OK with my recent changes as long as you aren't 
doing this on two documents with the same filename. I could fix this 
issue by using the full path from the project root in the window name 
... so a window-name might look more like this:

   "JSHint: src/core/graph.js"

If use window.close() in the future would I be able identify which 
window I wanted closed by name?


More information about the textmate mailing list