-
Notifications
You must be signed in to change notification settings - Fork 191
postal.unsubscribeFor
Unsubscribes any SubscriptionDefinition
instances matching the provided arguments
This method can be called 3 different ways:
Unsubscribes all of the current SubscriptionDefinition
objects which are subscribed to any topic on any channel.
Example Usage:
postal.unsubscribeFor();
### postal.unsubscribeFor( options )
Unsubscribes any SubscriptionDefinition
matching the options data provided.
options
- an object that can contain one or more of the following properties:
-
channel
- (optional) the channel name -
topic
- (optional) a topic that will be compared to theSubscriptionDefinition
topic binding using theresolver
. -
context
- (optional) an instance used in awithContext
call which lets you unsubscribe anySubscriptionDefinition
instances that are using a specificcontext
for their callbacks.
In addition to the above properties on the options
argument, you can provide any other properties which you might have added to the SubscriptionDefinition
instance. For example, if you've added a foo
property to the subscription with a value of "bar", you can call postal.unsubscribeFor({ foo: "bar" });
.
Example Usage:
var results = postal.unsubscribeFor({
channel:"orders",
topic: "customer.addItem"
});
### postal.utils.getSubscribersFor( predicate )
Unsubscribes any SubscriptionDefinition
matching the predicate data provided.
predicate
- a function that takes a SubscriptionDefinition
as an argument and returns true
if the SubscriptionDefinition
should be unsubscribed, or false
if not.
Example Usage:
// passing a predicate
var results = postal.getSubscribersFor(function (sub) {
return sub.foo === "bar";
});