Documentation
dojo/_base/connect¶
Contents
dojo/_base/connect contains functions for connecting to methods, events and topics. The functionality in this module is deprecated, but kept in the Dojo 1.X code stream for backwards compatiblity.
- If you want to connect to an event, see dojo/on instead.
- If you want to connect to a method, use Aspect Oriented Programming with after advice and see dojo/aspect::after() instead.
- If you want to publish or subscribe to topics, see dojo/topic instead.
Usage¶
As with the rest of dojo/_base modules, if you are running the Dojo loader in legacy mode (async: false) this module is automatically loaded. Even if it is automatically loaded, you should require it in to have access to its features:
require(["dojo/_base/connect"], function(connect){
// connect now has the module's features
});
Features¶
Method | Returns | Description |
---|---|---|
connect(obj,event,context,method,dontFix) | undefined |
Connects listeners to actions, so that after event fires, a listener is called with the same arguments passed to the original function. Since When setting up a connection, the
The return value is a handle that is needed to
remove this connection with |
connectPublisher(topic,obj,event) | undefined | Ensure that every time obj.event() is called, a message is published on the topic. Returns a handle which can be passed to dojo.disconnect() to disable subsequent automatic publication on the topic. |
disconnect(handle) | Remove a link created by dojo.connect. Removes the connection between event and the method referenced by handle. | |
isCopyKey(e) | undefined | Checks an event for the copy key (meta on Mac, and ctrl anywhere else) |
publish(topic,args) | undefined | Invoke all listener method subscribed to topic. |
subscribe(topic,context,method) | undefined | Attach a listener to a named topic. The listener function is invoked whenever the named topic is published (see: dojo.publish). Returns a handle which is needed to unsubscribe this listener. |
unsubscribe(handle) | Remove a topic listener. |
See Also¶
- dojo/on - Dojo event handling API
- dojo/topic - Dojo topic API
- dojo/aspect - Dojo Aspect Oriented Programming Core Module