Skip to content

Commit

Permalink
upgrade dependencies
Browse files Browse the repository at this point in the history
add unregisterHandler(s)
  • Loading branch information
Stephane Maldini committed Jan 15, 2013
1 parent b1ca992 commit 2f03b98
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 58 deletions.
2 changes: 1 addition & 1 deletion EventsPushGrailsPlugin.groovy
Expand Up @@ -26,7 +26,7 @@ import org.springframework.util.ClassUtils

class EventsPushGrailsPlugin {
// the plugin version
def version = "1.0.M4-SNAPSHOT"
def version = "1.0.M4"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "2.0 > *"
// the other plugins this plugin depends on
Expand Down
6 changes: 3 additions & 3 deletions application.properties
@@ -1,4 +1,4 @@
#Grails Metadata file
#Wed Sep 26 22:34:17 BST 2012
app.grails.version=2.2.0.RC2
app.name=events-push
#Tue Jan 15 20:50:19 GMT 2013
app.grails.version=2.2.0
app.name=events-push
4 changes: 2 additions & 2 deletions grails-app/conf/BuildConfig.groovy
Expand Up @@ -33,7 +33,7 @@ grails.project.dependency.resolution = {
}

plugins {
runtime(":jquery:1.8.0", ":hibernate:$grailsVersion") {
runtime(":jquery:1.8.3", ":hibernate:$grailsVersion") {
export = false
}

Expand All @@ -43,6 +43,6 @@ grails.project.dependency.resolution = {
) {
export = false
}
compile (':platform-core:1.0.RC2')
compile (':platform-core:1.0.RC4')
}
}
21 changes: 11 additions & 10 deletions web-app/js/grails/grailsEvents.js
Expand Up @@ -89,17 +89,21 @@ var grails = grails || {};
rq = jQuery.extend(rq, options);
rq = jQuery.extend(rq, request);

if (!that.globalTopicSocket) {
return socket.subscribe(rq);
} else {
if (that.globalTopicSocket) {
socket.unsubscribe();
that.globalTopicSocket = socket.subscribe(rq);
return that.globalTopicSocket;
}
that.globalTopicSocket = socket.subscribe(rq);
} else {
handlers[handlers.length] = handler;
}
return that.globalTopicSocket;
return handler;
};

that.unregisterHandlers = function (topic) {
checkSpecified("topic", 'string', topic);
delete handlerMap[topic];
socket.unsubscribeUrl(that.root + '/' + that.path + '/' + that.globalTopicName);
init();
};

that.unregisterHandler = function (topic, handler) {
Expand All @@ -111,10 +115,7 @@ var grails = grails || {};
var idx = handlers.indexOf(handler);
if (idx != -1) handlers.splice(idx, 1);
if (handlers.length == 0) {
// No more local handlers so we should unregister the connection
socket.unsubscribeUrl(that.root + '/' + that.path + '/' + that.globalTopicName);
init();
delete handlerMap[topic];
that.unregisterHandlers(topic);
}
}
};
Expand Down

0 comments on commit 2f03b98

Please sign in to comment.