Re: [Komodo-beta] API change: "koIView.document" is deprecated, use "koIView.koDoc"
Davide Ficano <[email protected]> Sun, 02 May 2010 11:39:52 +0200
| Newsgroups | gmane.comp.ide.komodo.general |
|---|---|
| Message-ID | <[email protected]> |
Trent Mick ha scritto:
> A note for Komodo developers (of Komodo itself, macros and extensions).
> Komodo's "koIView.document" has been deprecated in favour of
> "koIView.koDoc". This will be official in Komodo 6.0.0b1. The former
> will still work (but you'll get a deprecation warning in the log file).
>
> Basically this was done because "document" is waaay too confusing in
> JavaScript code with the DOM Document object called "document".
>
> This also affects the "komodo.document" argument in JS and Python
> macros. For Komodo 6, please move to using "komodo.koDoc". If you still
> need Komodo 5 compatibility, then you can continue to use ".document"
> (and live with deprecation warnings) or you could switch to
> capability-detection style code like:
>
> # JavaScript
> var koDoc = (komodo.koDoc === undefined ? komodo.document :
> komodo.koDoc);
>
> # Python
> koDoc = (komodo.koDoc if hasattr(komodo, "koDoc") else komodo.document)
>
>
> Cheers,
> Trent
>
I've started to make code compliant with koDoc but the operation is very invasive.
Constructs like shown below need to be revisited or the koDoc 'detection' workaround makes confused the code
var views = ko.views.manager.topView.findViewsForURI(uri);
if (views.length > 0 && views[0].document.file.isRemoteFile) { ... }
Other code can easily assign koDoc to a variable inside if(...) (but I really dislike similar code)
if (!ko.views.manager.batchMode
&& view
&& view.getAttribute("type") == "editor"
&& view.document) {
file = view.document.file;
}
Can be rewritten as shown below (note the myKoDoc var assigned inside the if statement)
if (!ko.views.manager.batchMode
&& view
&& view.getAttribute("type") == "editor"
&& (myKoDoc = view.koDoc || view.document)) {
file = myKoDoc.file;
}
I don't like to see warnings on the log but this time I'm considering to close my eyes
PS
I don't understand why I can see the warnings on Linux console but not on OSX terminal, obviously KO is started from
console/terminal.
BTW this isn't a real problem.
_______________________________________________
Komodo-discuss mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/Komodo-discuss