@isoloop/runtime 0.1.0-next.11 → 0.1.0-next.12
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.
- package/README.md +48 -0
- package/dist/bootstrap.js +1 -1
- package/dist/index.js +1 -1
- package/dist/worker.js +1 -1
- package/package.json +12 -4
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @isoloop/runtime
|
|
2
|
+
|
|
3
|
+
The [Isoloop](https://isoloop.dev) runtime inside each worker: write a part of your app as an isolate, with a UI or headless, in plain TypeScript.
|
|
4
|
+
|
|
5
|
+
## What you get
|
|
6
|
+
|
|
7
|
+
- **One way to write an isolate:** `defineIsolate` with a `start(ctx)`, for a widget, a feed, an engine or a request handler.
|
|
8
|
+
- **Plain DOM in a worker:** create elements, listen to input and style your surface, and the host draws it.
|
|
9
|
+
- **The bus:** typed publish and subscribe, straight to the bus worker, with replay after a restart.
|
|
10
|
+
- **The page when you need it:** async calls to measure, focus, scroll, navigate and get a canvas to draw on.
|
|
11
|
+
- **A lifecycle:** shutdown handlers, error reporting, and a hold against suspension.
|
|
12
|
+
- **Unit tests without a worker:** `createTestContext` from `@isoloop/runtime/testing`.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @isoloop/runtime@next
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { defineIsolate } from '@isoloop/runtime';
|
|
24
|
+
import { count } from './topics'; // a topic from your contracts
|
|
25
|
+
|
|
26
|
+
export default defineIsolate<HTMLElement>({
|
|
27
|
+
start(ctx) {
|
|
28
|
+
const label = document.createElement('p');
|
|
29
|
+
label.textContent = 'Waiting for a count';
|
|
30
|
+
ctx.root?.append(label);
|
|
31
|
+
|
|
32
|
+
ctx.bus.subscribe(
|
|
33
|
+
count,
|
|
34
|
+
(record) => {
|
|
35
|
+
label.textContent = `Count: ${record.value}`;
|
|
36
|
+
},
|
|
37
|
+
{ from: 'earliest' },
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Learn more
|
|
44
|
+
|
|
45
|
+
- [Writing isolates](https://isoloop.dev/docs/isolates/)
|
|
46
|
+
- [Testing isolates and contracts](https://isoloop.dev/docs/testing/)
|
|
47
|
+
- [What Isoloop can't hide](https://isoloop.dev/docs/limits/)
|
|
48
|
+
- [API reference](https://isoloop.dev/docs/api/runtime/)
|
package/dist/bootstrap.js
CHANGED
|
@@ -2703,7 +2703,7 @@ var init_render = __esmMin((() => {
|
|
|
2703
2703
|
headListeners = /* @__PURE__ */ new Set();
|
|
2704
2704
|
}));
|
|
2705
2705
|
// package.json
|
|
2706
|
-
var version = "0.1.0-next.
|
|
2706
|
+
var version = "0.1.0-next.12";
|
|
2707
2707
|
// src/isolate/vanilla.ts
|
|
2708
2708
|
var vanilla_exports = /* @__PURE__ */ __exportAll({
|
|
2709
2709
|
REQUIRES: () => REQUIRES,
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var HostCallError = class extends Error {
|
|
|
21
21
|
*
|
|
22
22
|
* @internal
|
|
23
23
|
*/
|
|
24
|
-
const REQUIRES = majorMinor("0.1.0-next.
|
|
24
|
+
const REQUIRES = majorMinor("0.1.0-next.12") ?? "0.0";
|
|
25
25
|
/**
|
|
26
26
|
* Types an isolate module's default export and stamps it with the version
|
|
27
27
|
* it was built against.
|
package/dist/worker.js
CHANGED
|
@@ -2686,7 +2686,7 @@ var init_render = __esmMin((() => {
|
|
|
2686
2686
|
headListeners = /* @__PURE__ */ new Set();
|
|
2687
2687
|
}));
|
|
2688
2688
|
// package.json
|
|
2689
|
-
var version = "0.1.0-next.
|
|
2689
|
+
var version = "0.1.0-next.12";
|
|
2690
2690
|
// src/isolate/vanilla.ts
|
|
2691
2691
|
var vanilla_exports = /* @__PURE__ */ __exportAll({
|
|
2692
2692
|
REQUIRES: () => REQUIRES,
|
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isoloop/runtime",
|
|
3
|
-
"version": "0.1.0-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-next.12",
|
|
4
|
+
"description": "The Isoloop runtime: write a part of your app as an isolate in a worker, with a UI or headless, in plain TypeScript.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"isoloop",
|
|
7
|
+
"web-workers",
|
|
8
|
+
"event-loop",
|
|
9
|
+
"isolation",
|
|
10
|
+
"microfrontends"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://isoloop.dev/docs/api/runtime/",
|
|
5
13
|
"license": "MIT",
|
|
6
14
|
"type": "module",
|
|
7
15
|
"sideEffects": [
|
|
@@ -35,8 +43,8 @@
|
|
|
35
43
|
}
|
|
36
44
|
},
|
|
37
45
|
"dependencies": {
|
|
38
|
-
"@isoloop/dom": "0.1.0-next.
|
|
39
|
-
"@isoloop/protocol": "0.1.0-next.
|
|
46
|
+
"@isoloop/dom": "0.1.0-next.12",
|
|
47
|
+
"@isoloop/protocol": "0.1.0-next.12"
|
|
40
48
|
},
|
|
41
49
|
"devDependencies": {
|
|
42
50
|
"typescript": "7.0.2"
|