Closed
Description
On file LiveQuerySubscription.js, line 109, which is class Subscription, method unsubscribe(), at the end is called this.resolve();
My code crash and says "unsubscribe resolve is not a function", which is true. I think that is a bug.
BTW: I couldn't find in test files any test checking "unsubscribe" function.
class Subscription extends EventEmitter {
/*
* @param {string} id - subscription id
* @param {string} query - query to subscribe to
* @param {string} sessionToken - optional session token
*/
constructor(id, query, sessionToken) {
super();
this.id = id;
this.query = query;
this.sessionToken = sessionToken;
}
/**
* closes the subscription
*/
unsubscribe() {
return CoreManager.getLiveQueryController().getDefaultLiveQueryClient().then((liveQueryClient) => {
liveQueryClient.unsubscribe(this);
this.emit('close');
this.resolve();
});
}
}
In the meanwhile I added to my subscription
object created with query.subscribe()
the static function promise.resolve
from npmjs package 'promise'. Basicaly my code is:
if (is.nullOrUndefined(this.mytSubscription.resolve)) {
this.mySubscription.resolve = Promise.resolve; }
this.mySubscription.unsubscribe();
this.mySubscription = undefined;
Best,
Gus