-
Notifications
You must be signed in to change notification settings - Fork 4
TopicProxyJS
Jason Dentler edited this page Jul 20, 2011
·
2 revisions
A topic proxy is a standard jQuery promise plus additional Topic methods. Any topic operation requested on this proxy will be executed as soon as the promise is resolved. For example, we can chain together group.TryCreateTopic and topic.PollFeed like this:
group.TryCreateTopic('Weather Chat', 'Chat about the weather')
.PollFeed(500)
.Subscribe(function (message) {
$("<li />").text(message).appendTo("#messages");
});
A topic proxy has these methods:
- Delete()
- PostMessage(data, contentType)
- PostStringMessage(message)
- GetAllMessages()
- PollFeed(interval)
- done(function (topic)) provides a callback to be called when the promise is resolved.
- fail(function (xhr, status, ex)) provides a callback to be called when the promise is rejected.