Inherited from ICancelable.cancel.
Inherited from IBoolCancelable.isCanceled.
Returns a BoolCancelable reference that is already canceled.
const ref = BoolCancelable.alreadyCanceled()
ref.isCanceled()
//=> true
// Doesn't do anything, it's a no-op
ref.cancel()
The implementation returns the same reusable reference.
Returns a BoolCancelable implementation that represents an immutable list of Cancelable references which can be canceled as a group.
const list = BoolCancelable.collection(
Cancelable.of(() => console.log("Cancelled #1")),
Cancelable.of(() => console.log("Cancelled #2")),
Cancelable.of(() => console.log("Cancelled #3"))
)
list.cancel()
//=> Cancelled #1
//=> Cancelled #2
//=> Cancelled #3
is the array of references to cancel when cancellation is triggered
Returns a BoolCancelable implementation that doesn't do
anything on cancel
except for changing the status of isCanceled
from false
to true
.
const task = BoolCancelable.empty()
task.isCanceled()
//=> false
task.cancel()
task.isCanceled()
//=> true
Lifts any callback into a BoolCancelable
reference.
const task = BoolCancelable.of(() => {
console.log("I was canceled!")
})
task.isCanceled()
//=> false
task.cancel()
//=> I was canceled!
task.isCanceled()
//=> true
The returned reference has guaranteed idempotence, so calling it multiple times will trigger the given callback only once.
Generated using TypeDoc
BoolCancelable
is an IBoolCancelable class providing useful builders for cancelable references that can be queried for their canceled status.