firemail
标题:
将 JSON 对象通知出去
[打印本页]
作者:
hechengjin
时间:
2016-3-27 23:35
标题:
将 JSON 对象通知出去
var jsonObj = {};
var observerService = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
jsonObj.wrappedJSObject = jsonObj;
observerService.notifyObservers(jsonObj, "JsonObjNotify", "");
接收时:
observerService.addObserver(observer, "JsonObjNotify", false);
observe: function(subject, topic, data) {
var jsonReceived = subject.wrappedJSObject;
}
即可。详情请见:
https://developer.mozilla.org/en-US/docs/wrappedJSObject
欢迎光临 firemail (http://firemail.wang:8088/)
Powered by Discuz! X3