How to send & receive inter-control messages
Dispatches a message. The message must be a constant, defined in OAT.MSG. Developers are encouraged to add more message types; example messages: OAT_LOAD, TREE_EXPAND, AJAX_FAILURE. sender should equal to object sending this message. event is an object carrying data relevant to this message; no particular format is required.
Subscribes to receiving messages. sender equals to object whose messages we want to receive; value of "*"
means ALL senders.
message is the message we want to receive; it is possible to use "*"
or RegExp matches here. When a message arrives,
callback is executed with arguments passed to appropriate OAT.MSG.send function.
Detaches previously set message receiving handler. All three fields must match.
/* assume that there exists OAT.MSG.CUSTOM_MESSAGE */ function myMessageHander(source, message, event) { alert("Message arrived!"(; } /* subscribe to receiving... */ OAT.MSG.attach("*","CUSTOM_.*",myMessageHandler); /* dispatch message */ OAT.MSG.send(this, OAT.MSG.CUSTOM_MESSAGE, {}); // will invoke myMessageHandler