-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
694018b
commit af8ecd0
Showing
5 changed files
with
139 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@function can-queues.lastTask lastTask | ||
@parent can-queues/methods | ||
|
||
@description Return last task to be flushed. | ||
|
||
@signature `queues.lastTask()` | ||
|
||
```js | ||
import {queues} from "can"; | ||
|
||
queues.lastTask() //-> {fn, args, context, meta} | ||
``` | ||
|
||
@return {Object} Returns a task object that contains: | ||
|
||
- `fn` - The function run | ||
- `args` - The arguments passed to the function | ||
- `context` - The context (`this`) the function was called on | ||
- `meta` - Additional information about the task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@function can-queues.runAsTask runAsTask | ||
@parent can-queues/methods | ||
|
||
@description Return a function that when called, adds a task that can be logged by [can-queues.logStack]. | ||
|
||
@signature `queues.runAsTask( fn [, makeReasonLog] )` | ||
|
||
This is useful for debugging. | ||
|
||
```js | ||
import {queues} from "can"; | ||
|
||
var task = queues.runAsTask(function myTask(){ | ||
queues.logStack() | ||
}, function(){ | ||
return ["myTask called on", this, "with",arguments]; | ||
}); | ||
|
||
task(); | ||
``` | ||
|
||
In production, `runAsTask` simply returns the `fn` argument. | ||
|
||
@param {function} fn A function that will be called by the returned function. | ||
@param {function} [makeReasonLog] A function that will be called with the same `this` and arguments that the returned | ||
function was called with. | ||
@return {function} A function that calls `fn`. |