diff --git a/README.md b/README.md index 824df76..85c7275 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,9 @@ channel channel channel: 细流 part-server: 调谐, 从不同服务器请求资源分片 webrtc://用户@域名:端口/信道标识/资源ID +封包格式 +资源ID 分片信息(位置) 分片数据 + 1. 每个节点都公开持有的资源列表, 和连接的节点列表 2. 每当资源变动时告知所有连接的节点 3. 与节点创建多个RTC时, 不发送多份, 以ID为准, id随机生成给不同机器, 无法通过ID锁定其它机器 diff --git a/public/entanglement.js b/public/entanglement.js index d45d169..a004176 100644 --- a/public/entanglement.js +++ b/public/entanglement.js @@ -162,7 +162,7 @@ export default class Entanglement { // 数据被修改时触发 set(name, data) { // 递归创建代理对象 - const createDeepProxy = (obj, path = []) => { + const useProxy = (obj, path = []) => { const proxy = new Proxy(obj, { set: (target, key, value) => { if (!Array.isArray(target) || key !== 'length') { @@ -177,12 +177,12 @@ export default class Entanglement { }) Object.keys(obj).forEach(key => { if (typeof obj[key] === 'object') { - obj[key] = createDeepProxy(obj[key], [...path, key]) + obj[key] = useProxy(obj[key], [...path, key]) } }) return proxy } - return Reflect.set(this.store, name, createDeepProxy(data)) + return Reflect.set(this.store, name, useProxy(data)) } // 读取一个通道 diff --git a/public/test.html b/public/test.html index faa9b1e..756584a 100644 --- a/public/test.html +++ b/public/test.html @@ -12,72 +12,82 @@
同步