Tweak docs.
This commit is contained in:
@@ -75,7 +75,7 @@ Similar to `Fiber.yield` but provides a value to return to the parent fiber's
|
||||
|
||||
### **call**()
|
||||
|
||||
Invokes the fiber or resumes the fiber if it is in a paused state.
|
||||
Starts or resumes the fiber if it is in a paused state.
|
||||
|
||||
:::dart
|
||||
var fiber = new Fiber {
|
||||
@@ -83,8 +83,23 @@ Invokes the fiber or resumes the fiber if it is in a paused state.
|
||||
Fiber.yield()
|
||||
IO.print("Fiber called again")
|
||||
}
|
||||
|
||||
fiber.call() // Start it.
|
||||
fiber.call() // Resume after the yield() call.
|
||||
|
||||
When the called fiber yields, control is transferred back to the fiber that
|
||||
called it.
|
||||
|
||||
If the called fiber is resuming from a yield, the `yield()` method returns
|
||||
`null` in the called fiber.
|
||||
|
||||
:::dart
|
||||
var fiber = new Fiber {
|
||||
IO.print(Fiber.yield())
|
||||
}
|
||||
|
||||
fiber.call()
|
||||
fiber.call()
|
||||
fiber.call() // Prints "null".
|
||||
|
||||
### **call**(value)
|
||||
|
||||
@@ -93,11 +108,11 @@ Invokes the fiber or resumes the fiber if it is in a paused state and sets
|
||||
|
||||
:::dart
|
||||
var fiber = new Fiber {
|
||||
var value = Fiber.yield()
|
||||
IO.print(value + 1)
|
||||
IO.print(Fiber.yield())
|
||||
}
|
||||
|
||||
fiber.call()
|
||||
fiber.call(1) // 2.
|
||||
fiber.call("value") // Prints "value".
|
||||
|
||||
### **isDone**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user