@aawwaaa/astralcore-syncer 1.0.0 → 1.0.1

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 (2) hide show
  1. package/README.md +12 -11
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -19,8 +19,8 @@
19
19
 
20
20
  ### 代码示例
21
21
 
22
- ```ts
23
- // shared.ts
22
+ ```js
23
+ // shared.js
24
24
  import { Resource } from "@aawwaaa/astralcore-syncer";
25
25
 
26
26
  export class SharedDoc extends Resource {
@@ -32,10 +32,10 @@ export class SharedDoc extends Resource {
32
32
 
33
33
  export const SharedDocDef = Resource.define(SharedDoc, "shared-doc").invoke("modify");
34
34
  ```
35
- ```ts
36
- // server.ts
35
+ ```js
36
+ // server.js
37
37
  import { ResourceEnvironment, resourceEnvironmentSetImpl } from "@aawwaaa/astralcore-syncer";
38
- import { ServerMemoryResourceManager } from "@aawwaaa/astralcore-syncer/impl/server";
38
+ import { ServerMemoryResourceManager } from "@aawwaaa/astralcore-syncer/impl/server/resource-memory";
39
39
  import { ServerWebsocketRemoteManager } from "@aawwaaa/astralcore-syncer/impl/server/remote-websocket";
40
40
  import express from "express";
41
41
  import expressWs from "express-ws";
@@ -54,15 +54,16 @@ const { app } = expressWs(express());
54
54
  app.ws("/ws", (ws) => remote.handleWebSocket(ws));
55
55
  app.listen(8000, () => console.log("Server on :8000"));
56
56
  ```
57
- ```ts
58
- // client.ts
57
+ ```js
58
+ // client.js
59
59
  import { ResourceEnvironment, resourceEnvironmentSetImpl } from "@aawwaaa/astralcore-syncer";
60
- import { ClientWebsocketRemoteManager } from "@aawwaaa/astralcore-syncer/impl/client";
61
- import { ClientRemoteResourceManager } from "@aawwaaa/astralcore-syncer/impl/client";
60
+ import { ClientWebsocketRemoteManager } from "@aawwaaa/astralcore-syncer/impl/client/remote-websocket";
61
+ import { ClientRemoteResourceManager } from "@aawwaaa/astralcore-syncer/impl/client/resource-remote";
62
62
  import { SharedDocDef } from "./shared";
63
63
 
64
64
  const remote = new ClientWebsocketRemoteManager("/ws").init();
65
- resourceEnvironmentSetImpl(() => new ResourceEnvironment(remote, new ClientRemoteResourceManager(remote)));
65
+ const impl = new ResourceEnvironment(remote, new ClientRemoteResourceManager(remote));
66
+ resourceEnvironmentSetImpl(() => impl);
66
67
 
67
68
  using doc = await SharedDocDef.resolve("main");
68
69
  const textarea = document.getElementById("edit");
@@ -190,4 +191,4 @@ MIT © aawwaaa
190
191
 
191
192
  <p align="center">
192
193
  <sub>less than 1000 lines of core. unlimited real-time possibilities.</sub>
193
- </p>
194
+ </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aawwaaa/astralcore-syncer",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A lightweight library to connect objects together",
5
5
  "scripts": {
6
6
  "build": "tsc"