@thi.ng/fibers 0.6.30 → 0.6.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/csp.js +15 -15
  3. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-03-13T14:04:31Z
3
+ - **Last updated**: 2024-03-18T08:40:00Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/csp.js CHANGED
@@ -27,14 +27,14 @@ class Channel {
27
27
  * ```
28
28
  */
29
29
  read() {
30
- const $this = this;
30
+ const chan = this;
31
31
  return fiber(function* (ctx) {
32
- while ($this.readable()) {
33
- if ($this.buffer.readable()) {
34
- const val = $this.buffer.read();
32
+ while (chan.readable()) {
33
+ if (chan.buffer.readable()) {
34
+ const val = chan.buffer.read();
35
35
  ctx.logger?.debug("read", val);
36
36
  return val;
37
- } else if ($this.state === STATE_CLOSING) {
37
+ } else if (chan.state === STATE_CLOSING) {
38
38
  return;
39
39
  }
40
40
  yield;
@@ -56,12 +56,12 @@ class Channel {
56
56
  * ```
57
57
  */
58
58
  write(val) {
59
- const $this = this;
59
+ const chan = this;
60
60
  return fiber(function* (ctx) {
61
- while ($this.writable()) {
62
- if ($this.buffer.writable()) {
61
+ while (chan.writable()) {
62
+ if (chan.buffer.writable()) {
63
63
  ctx.logger?.debug("write", val);
64
- $this.buffer.write(val);
64
+ chan.buffer.write(val);
65
65
  return;
66
66
  }
67
67
  yield;
@@ -79,18 +79,18 @@ class Channel {
79
79
  * @param wait
80
80
  */
81
81
  close(wait = true) {
82
- const $this = this;
82
+ const chan = this;
83
83
  return fiber(function* (ctx) {
84
- if ($this.state >= STATE_CLOSING)
84
+ if (chan.state >= STATE_CLOSING)
85
85
  return;
86
86
  if (wait) {
87
87
  ctx.logger?.debug("waiting to close...");
88
- $this.state = STATE_CLOSING;
89
- while ($this.buffer.readable())
88
+ chan.state = STATE_CLOSING;
89
+ while (chan.buffer.readable())
90
90
  yield;
91
91
  }
92
- $this.state = STATE_CLOSED;
93
- $this.buffer.clear();
92
+ chan.state = STATE_CLOSED;
93
+ chan.buffer.clear();
94
94
  ctx.logger?.debug("channel closed");
95
95
  }, this.opts);
96
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/fibers",
3
- "version": "0.6.30",
3
+ "version": "0.6.32",
4
4
  "description": "Process hierarchies & operators for cooperative multitasking",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@thi.ng/api": "^8.9.30",
40
- "@thi.ng/arrays": "^2.8.9",
40
+ "@thi.ng/arrays": "^2.8.11",
41
41
  "@thi.ng/bench": "^3.5.0",
42
- "@thi.ng/checks": "^3.5.3",
42
+ "@thi.ng/checks": "^3.5.4",
43
43
  "@thi.ng/errors": "^2.5.1",
44
44
  "@thi.ng/idgen": "^2.2.35",
45
45
  "@thi.ng/logger": "^3.0.6",
46
- "@thi.ng/random": "^3.6.38"
46
+ "@thi.ng/random": "^3.7.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@microsoft/api-extractor": "^7.42.3",
@@ -109,5 +109,5 @@
109
109
  "status": "alpha",
110
110
  "year": 2023
111
111
  },
112
- "gitHead": "bc0f3cb07d6f1cab6dbdc5ff57428f5484e711bb\n"
112
+ "gitHead": "da965520b2f3f8c259a791e8e8864308be2ba0be\n"
113
113
  }