In the Deezer Javascript SDK, the DZ.Event.unsubscribe
method can be used to unsubscribe all subscriptions for a specific event, but is there any way to unsubscribe a specific subscription instead of all of them?
The DZ.Event.subscribe
method doesn't return any ID that could be given in the unsubscription call, and sending the subscription callback function to the unsubscription method doesn't work either:
function callback(args) {
console.log('GOT player_position 1', args);
}
DZ.Event.subscribe('player_position', callback);
DZ.Event.subscribe('player_position', args => {
console.log('GOT player_position 2', args);
});
DZ.Event.unsubscribe('player_position', callback); // Unsubscribes both subscriptions
There are currently only nasty ways to do this with access to
DZ.Event.callbacks
For instance you can: