Browse Source

1.0.0

master
svinokot 3 months ago
parent
commit
414dcf44d4
  1. 2
      README.md
  2. 2
      package.json
  3. 4
      public_html/index.html
  4. 2
      src/task-queue.js

2
README.md

@ -17,7 +17,7 @@ import { join, all, put } './task-queue.js';
**Base scenarios**
* `join(...f)(x)` - like `y = await f[0](x); z = await f[1](y); ... f[n];`
* `all(...f)(x)` - like `Promise.all([...f.map(fn => fn(x))])`
* `put(key, f)(x)` - like `f(x).then(a => ({ [key]: a }))`
* `put(key, f)(x)` - like `f(x[key]).then(a => ({ [key]: a }))`
Each scenario does not call requests immediately after creation, but only creates a script described in `...tasks`.
In order for the request has been executed, you need to call the ready-made scenario, like the function:

2
package.json

@ -1,6 +1,6 @@
{
"name": "@vovikilelik/task-queue-js",
"version": "1.0.0-rc.2",
"version": "1.0.0",
"keywords": [
"util",
"functional",

4
public_html/index.html

@ -44,12 +44,12 @@ and open the template in the editor.
createTask(undefined, 100),
put('put-false', false),
put('put-undefined', undefined),
put('put-subtask', subtask),
put('put-subtask', console.log),
subtask,
v('tree'),
);
task(v('init')).then(console.log);
task({ [`put-subtask`]: { p: 0 } }).then(console.log);
</script>
</body>
</html>

2
src/task-queue.js

@ -38,7 +38,7 @@ export const put = (key, task) => (data) => {
if (task === undefined) return;
const uniformTask = _taskMapper(task);
return _call(uniformTask(data)).then(response => {
return _call(uniformTask(data[key])).then(response => {
return (response === undefined ? undefined : { [key]: response });
});
}
Loading…
Cancel
Save