Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions release/angular-wamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,27 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
connection.open();
}
},

//Add or update initial options. Does not delete!
setOptions: function(updatedOptions, closeOld, openNew) {
if (closeOld && connection.isOpen) {
connection.close();
}

angular.extend(options, updatedOptions);

if (openNew) {
connection.open();
}
},

setAuthId: function (authid, open) {
options.authid = authid;
if (open) {
connection.open();
}
},

close: function () {
connection.close();
},
Expand Down
2 changes: 1 addition & 1 deletion release/angular-wamp.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions src/angular-wamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
**/
var interceptors = this.interceptors = [];

this.$get = function ($rootScope, $q, $log, $injector) {
this.$get = ["$rootScope", "$q", "$log", "$injector", function ($rootScope, $q, $log, $injector) {

/**
* @ngdoc service
Expand Down Expand Up @@ -387,12 +387,27 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
connection.open();
}
},

//Add or update initial options. Does not delete!
setOptions: function(updatedOptions, closeOld, openNew) {
if (closeOld && connection.isOpen) {
connection.close();
}

angular.extend(options, updatedOptions);

if (openNew) {
connection.open();
}
},

setAuthId: function (authid, open) {
options.authid = authid;
if (open) {
connection.open();
}
},

close: function () {
connection.close();
},
Expand Down Expand Up @@ -437,7 +452,7 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
});
}
};
};
}];

return this;

Expand Down