[otrs-cvs] otrs/var/httpd/htdocs/js Core.App.js, 1.11, 1.12 Core.AJAX.js, 1.34, 1.35
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/var/httpd/htdocs/js
In directory lancelot:/tmp/cvs-serv30876/var/httpd/htdocs/js
Modified Files:
Core.App.js Core.AJAX.js
Log Message:
Added PubSub to OTRS. Added wrapper functions to Core.App. Added first channels to Core.AJAX.
Author: mn
Index: Core.App.js
===================================================================
RCS file: /home/cvs/otrs/var/httpd/htdocs/js/Core.App.js,v
retrieving revision 1.11
retrieving revision 1.12
diff -2 -u -d -r1.11 -r1.12
--- Core.App.js 26 Nov 2012 11:12:26 -0000 1.11
+++ Core.App.js 17 Dec 2012 10:46:20 -0000 1.12
@@ -110,4 +110,39 @@
};
+ /**
+ * @function
+ * Publish some data on a named topic
+ * @param {String} Topic The channel to publish on
+ * @param {Array} Args The data to publish.
+ * Each array item is converted into an ordered
+ * arguments on the subscribed functions.
+ */
+ TargetNS.Publish = function (Topic, Args) {
+ $.publish(Topic, Args);
+ }
+
+ /**
+ * @function
+ * Register a callback on a named topic
+ * @param {String} Topic The channel to subscribe to
+ * @param {Function} Callback The handler event.
+ * Anytime something is published on a
+ * subscribed channel, the callback will be called with the
+ * published array as ordered arguments.
+ * @return {Array} A handle which can be used to unsubscribe this particular subscription
+ */
+ TargetNS.Subscribe = function (Topic, Callback) {
+ return $.subscribe(Topic, Callback);
+ }
+
+ /**
+ * @function
+ * Disconnect a subscribed function for a topic
+ * @param {Array} Handle The return value from a $.subscribe call
+ */
+ TargetNS.Unsubscribe = function (Handle) {
+ $.unsubscribe(Handle);
+ }
+
return TargetNS;
}(Core.App || {}));
Author: mn
Index: Core.AJAX.js
===================================================================
RCS file: /home/cvs/otrs/var/httpd/htdocs/js/Core.AJAX.js,v
retrieving revision 1.34
retrieving revision 1.35
diff -2 -u -d -r1.34 -r1.35
--- Core.AJAX.js 28 Mar 2012 06:24:51 -0000 1.34
+++ Core.AJAX.js 17 Dec 2012 10:46:20 -0000 1.35
@@ -248,4 +248,5 @@
SuccessCallback();
}
+ Core.App.Publish('Event.AJAX.FormUpdate.Callback', [Response]);
}
},
@@ -305,4 +306,5 @@
Callback();
}
+ Core.App.Publish('Event.AJAX.ContentUpdate.Callback', [Response]);
},
error: function () {
@@ -340,4 +342,6 @@
if ($.isFunction(Callback)) {
Callback(Response);
+ // publish to event channel
+ Core.App.Publish('Event.AJAX.FunctionCall.Callback', [Response]);
}
else {
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log