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

Stephen Bannasch stephen.bannasch at deanbrook.org
Sun Sep 15 22:01:43 UTC 2013


At 11:57 AM +0200 9/15/13, Allan Odgaard wrote:
>On 13 Sep 2013, at 14:17, Stephen Bannasch wrote:
>
>>>In theory you can use 'window.close()' to close windows (from JavaScript).
>>>In practice there is a bug in WebKit [Š]
>
>For the records, alpha.9477 has a workaround for (alleged) the bug.

Can you point me to an existing bundle which uses window.close() ... 
or an example of how to use it?

>
>>[Š] If use window.close() in the future would I be able identify 
>>which window I wanted closed by name?
>
>No, it will close the HTML output window (or split) from which it is 
>being called.
>
>It's unclear to me though how you can target specific windows for 
>different documents when showing the errors in the first place.

When I generate the html which is sent to the output window I 
dynamically generate the value for the <title> element so be "JSHint: 
<name-of-file>".

https://github.com/fgnass/jshint.tmbundle/blob/3f709/Support/jshint-tm.js#L183-L192

The use pattern I then support is to follow this by making changes in 
the current JS doc and running the jshint checker again.

Evidently if a window already exists with the right name 
process.exit(205) uses that same window to re-display the error 
output.

These same features work together to allow multiple independent error 
windows to be opened and also independently closed when the all the 
errors are resolved for that specific document.


More information about the textmate mailing list