##// END OF EJS Templates
frontend: topics implementation needs to live in CE edition
ergo -
r340:2e3f4ad7 default
parent child Browse files
Show More
@@ -0,0 +1,50 b''
1 // # Copyright (C) 2010-2016 RhodeCode GmbH
2 // #
3 // # This program is free software: you can redistribute it and/or modify
4 // # it under the terms of the GNU Affero General Public License, version 3
5 // # (only), as published by the Free Software Foundation.
6 // #
7 // # This program is distributed in the hope that it will be useful,
8 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // # GNU General Public License for more details.
11 // #
12 // # You should have received a copy of the GNU Affero General Public License
13 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 // #
15 // # This program is dual-licensed. If you wish to learn more about the
16 // # RhodeCode Enterprise Edition, including its added features, Support services,
17 // # and proprietary license terms, please see https://rhodecode.com/licenses/
18
19
20 var topics = {};
21 jQuery.Topic = function (id) {
22 var callbacks, method,
23 topic = id && topics[id];
24
25 if (!topic) {
26 callbacks = jQuery.Callbacks();
27 topic = {
28 unhandledData: [],
29 publish: callbacks.fire,
30 prepare: function(){
31 for(var i=0; i< arguments.length; i++){
32 this.unhandledData.push(arguments[i]);
33 }
34 },
35 processPrepared: function(){
36 var data = this.unhandledData;
37 this.unhandledData = [];
38 for(var i=0; i< data.length; i++){
39 this.publish(data[i]);
40 }
41 },
42 subscribe: callbacks.add,
43 unsubscribe: callbacks.remove
44 };
45 if (id) {
46 topics[id] = topic;
47 }
48 }
49 return topic;
50 };
@@ -56,6 +56,7 b' module.exports = function(grunt) {'
56 56 '<%= dirs.js.src %>/rhodecode/utils/colorgenerator.js',
57 57 '<%= dirs.js.src %>/rhodecode/utils/ie.js',
58 58 '<%= dirs.js.src %>/rhodecode/utils/os.js',
59 '<%= dirs.js.src %>/rhodecode/utils/topics.js',
59 60
60 61 // Rhodecode widgets
61 62 '<%= dirs.js.src %>/rhodecode/widgets/multiselect.js',
General Comments 0
You need to be logged in to leave comments. Login now