1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/mirrors-dojo

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
topic.js 1 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Bill Keese Отправлено 24.06.2012 06:23 8695403
define(["./Evented"], function(Evented){
// module:
// dojo/topic
var hub = new Evented;
return {
// summary:
// Pubsub hub.
// example:
// | topic.subscribe("some/topic", function(event){
// | ... do something with event
// | });
// | topic.publish("some/topic", {name:"some event", ...});
publish: function(topic, event){
// summary:
// Publishes a message to a topic on the pub/sub hub. All arguments after
// the first will be passed to the subscribers, so any number of arguments
// can be provided (not just event).
// topic: String
// The name of the topic to publish to
// event: Object
// An event to distribute to the topic listeners
return hub.emit.apply(hub, arguments);
},
subscribe: function(topic, listener){
// summary:
// Subscribes to a topic on the pub/sub hub
// topic: String
// The topic to subscribe to
// listener: Function
// A function to call when a message is published to the given topic
return hub.on.apply(hub, arguments);
}
};
});

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/mirrors-dojo.git
git@api.gitlife.ru:oschina-mirror/mirrors-dojo.git
oschina-mirror
mirrors-dojo
mirrors-dojo
master