README > MODULE > uu.module.messagePump
var XFile = uu.klass.generic();
XFile.prototype = {
construct: function(agent) {
this.agent = agent;
},
msgbox: function(msg, p1, p2) {
uu.log("%s say, I accepted a message [%s], from %s", this.agent, msg, p1.from);
}
};
var agent1 = new XFile("Agent Mulder");
var agent2 = new XFile("Agent Scully");
var agent3 = new XFile("Smoking Man");
uu.msg.post(agent1, "Hello Mulder", { from: "Scully" }); // スカリーからモルダーにご挨拶
uu.msg.post(0, "Hi All", { from: "Mulder" }); // モルダーが(自分も含め)みんなにご挨拶
uu.msg.send(agent1, "...", { from: "Smoking Man" }); // スモーキングマンがモルダーだけにお返事
uu.msg.post([agent2, agent3], "Samantha was abducted",
{ from: "Mulder" }); // モルダーが(自分以外の人に)いつものご乱心