voryx / angular-wamp

An AngularJS library for AutobahnJS (WAMP v2)
MIT License
133 stars 28 forks source link

subscribeOnScope promise does not return subscription #47

Closed kryo2k closed 8 years ago

kryo2k commented 8 years ago

https://github.com/voryx/angular-wamp/blob/master/src/angular-wamp.js#L399-L401

Suggesting to add:

return subscription;

Currently promise returns undefined. I worked around this with an extension of that method.

Patched:

subscribeOnScope: function (scope, channel, callback) {
    return this.subscribe(channel, callback).then(function (subscription) {
        scope.$on('$destroy', function () {
            return subscription.unsubscribe();
        });
        return subscription;
    });
},
bondt commented 8 years ago

@davidwdan Thanks! @kryo2k Tested and works. Can you verify?

davidwdan commented 8 years ago

Fixed https://github.com/voryx/angular-wamp/pull/51