On 4月27日, 下午3时05分, Boris Zbarsky <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > I try it, but not work, target don't have wrappedJSObject property.
>
> Then it's not a wrapper for a JSObject....
>
> -Boris
sorry, I get it.
It seem that I should assign the wrappedJSObject to the object first.
thrank you!
// in component
function Task() {
}
Task.prototype = {run:function () {
var obj = {};
//send the javascript object back through observer;
//+++++++++++++++++++ assign the property
obj.wrappedJSObject = obj;
this.callback.observe(obj, "task begin", null);
}, setCallback:function (cb) {
this.callback = cb;
return this;
}};
// nsIObserver in invoker.
Callback.prototype.observe = function (target, subject, param) {
//how to convert the target(nsISupports) to javascript object;
// now I can use the wrapped property;
var obj = target.wrappedJSObject;
.....
};
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom