- From: Maciej Stachowiak <mjs@apple.com>
- Date: Thu, 19 Jul 2007 19:49:17 -0700
On Jul 19, 2007, at 5:53 AM, Kri?tof ?elechovski wrote: > > >> I'll agree that calling postMessage on the other window feels like >> a better and more intuitive API for users, but if implementers have >> to make such invasive and potentially-unsafe changes to do it, I >> think it's the wrong way to do it. >> > > How come? "otherWindow.postMessage(M)" translates to AppleScript > "tell otherWindow to post message M". It is not what you want to do > here. You can either "tell thisWindow to post message M to > otherWindow"-which is good because thisWindow can intercept the > message and handle the fact that you are trying to post according to > an event handler that may be attached-or "tell otherWindow to > receive message M from thisWindow" which is wrong because thisWindow > is unaware that you pretend it is posting a message. If you follow > this path nevertheless, you should call it receiveMessage, not > postMessage. I don't think AppleScript is very useful to understanding API design in languages with more conventional syntax. For example, document.write("foobar") is not very well expressed as 'tell document to write "foobar"', it would be more accurate to say 'write "foobar" to document'. Regards, Maciej
Received on Thursday, 19 July 2007 19:49:17 UTC