Rx.Subscription
class
Records information about subscriptions to and unsubscriptions from observable sequences.
Location
- rx.testing.js
Subscription Constructor
Subscription Instance Methods
Subscription Instance Properties
Subscription Constructor
Rx.Subscription(subscribe, unsubscribe)
Creates a new subscription object with the given virtual subscription and unsubscription time.
参数
subscribe
(Number): Virtual time at which the subscription occurred.[unsubscribe = Number.MAX_VALUE]
(Number): Virtual time at which the unsubscription occurred.
例
var subscription = new Rx.Subscription(200, 1000);
console.log(recorded.time);
// => 200
console.log(recorded.unsubscribe);
// => 1000
Location
- rx.testing.js
Subscription Instance Methods
Rx.Subscription.prototype.equals(other)
Checks whether the given subscription is equal to the current instance.
参数
other
(Subscription): Subscription object to check for equality.
返回值
(Boolean): Returns true
if the Subscription equals the other, else false
.
例
var s1 = new Subscription(201, 500);
var s2 = new Subscription(201);
var s3 = new Subscription(201, 500);
console.log(s1.equals(s2));
// => false
console.log(s1.equals(s3));
// => true
Location
- rx.testing.js
Rx.Subscription.prototype.toString()
Returns a string representation of the current Subscription value.
返回值
(String): String representation of the current Subscription value.
例
var s1 = new Subscription(201);
console.log(s1.toString());
// => (201, Infinite)
var s2 = new Subscription(201, 1000);
console.log(s2.toString());
// => (201, 1000)
Location
- rx.testing.js
Subscription Instance Properties
subscribe
Gets the subscription virtual time.
返回值
(Number): The subscription virtual time.
例
var s1 = new Subscription(201);
console.log(s1.subscribe);
// => 201
Location
- rx.testing.js
unsubscribe
Gets the unsubscription virtual time.
返回值
(Number): The unsubscription virtual time.
例
var s1 = new Subscription(201, 500);
console.log(r1.unsubscribe);
// => foo
Location
- rx.testing.js