quote:
Originally posted by Matti
That is truly amazing!
Thanks.
quote:
Originally posted by Matti
Here's a suggestion: use combined getter/setter methods for the properties in the wrapper classes. Instead of storing this.original.Size in this.Size, make a method Size which can be called as a getter with Size() or as a setter with Size(newSize). Right now every wrapped property is read-only, although some properties should be read/write such as DataBloc.Size or Messenger.MyStatus.
Hmm, I just tested this... I guess it's something I overlooked. Oops! I'll change them all to the combined getter/setter functions as you suggested soon.
quote:
Originally posted by Matti
Another thing I noticed is that you're extending Object.prototype. While this may work just fine in your library when using your version of Object.prototype.forEach, this surely will break a lot of scripts which iterate over plain objects using a standard for...in loop without the Object.prototype.hasOwnProperty check. I think it's better to simply drop the prototype extensions and only extend the static Object. This is not so much of an issue with the Array and String prototypes, as those should never be iterated over with for...in anyway.
Yeah, I realised that was terrible after I started to REALLY understand ECMAScript... Haven't had time to move them from Object to plusQuery yet. And people who don't check for hasOwnProperty while iterating are silly. But... I guess I have to take that into account.
quote:
Originally posted by Matti
The thing I miss is (of course) event binding on PlusWnd objects. If this were possible, we could write classes to work with window controls which can bind the necessary handlers to the used window events. Now, I understand that this is very tough to implement and would probably require a lot of hackish constructions. I found a way to inject function in the global object in run-time, but it's very, very ugly. Hopefully the event architecture gets fixed/improved in some future version of Plus!...
Yeah, I thought about it for a bit, and had no idea. The global variable in JScript seems REALLY screwey.
Doesn't seem to be a way that I can see which adds properties to it.
js code:
function OnMyWndEvent_Cancel(plusWnd) {
$.trigger(plusWnd, "MyWndEvent_Cancel", plusQuery.$A(arguments));
}
$.addEventListener("MyWndEvent_Cancel", function (plusWnd) {
//do stuff here
});
$.addEventListener("MyWndEvent_Cancel", function (plusWnd) {
//do other stuff here
});
It would be so much easier if you could just add it to the global variable.
How did you manage to do it?