hsync 0.12.0 → 0.13.0

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/dist/hsync.js CHANGED
@@ -35,7 +35,7 @@ eval("const fetch = __webpack_require__(/*! isomorphic-fetch */ \"./node_modules
35
35
  \**********************/
36
36
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
37
37
 
38
- eval("const mqtt = __webpack_require__(/*! precompiled-mqtt */ \"./node_modules/precompiled-mqtt/dist/mqtt.browser.js\");\nconst buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\nconst net = __webpack_require__(/*! net-web */ \"./node_modules/net-web/net-web.js\");\nconst { createHsync, setNet, setMqtt } = __webpack_require__(/*! ./connection */ \"./connection.js\");\nconst config = __webpack_require__(/*! ./config */ \"./config.js\");\n\n// TODO need to make this work with web/service workers\nwindow.Buffer = buffer.Buffer;\n\nsetNet(net);\nsetMqtt(mqtt);\n\nasync function dynamicConnect(dynamicHost, useLocalStorage) {\n let con;\n if (useLocalStorage) {\n const localConfigStr = localStorage.getItem('hsyncConfig');\n if (localConfigStr) {\n const localConfig = JSON.parse(localConfigStr);\n if ((Date.now() - localConfig.created) < (localConfig.timeout * 0.66)) {\n config.hsyncSecret = localConfig.hsyncSecret;\n config.hsyncServer = localConfig.hsyncServer;\n }\n }\n \n if (!config.hsyncSecret) {\n config.dynamicHost = dynamicHost || config.defaultDynamicHost;\n }\n \n con = await createHsync(config);\n \n if (config.dynamicHost) {\n const storeConfig = {\n hsyncSecret: con.hsyncSecret,\n hsyncServer: con.hsyncServer,\n timeout: con.dynamicTimeout,\n created: Date.now(),\n };\n localStorage.setItem('hsyncConfig', JSON.stringify(storeConfig));\n }\n\n return con;\n }\n\n config.dynamicHost = dynamicHost || config.defaultDynamicHost;\n con = await createHsync(config);\n\n return con;\n \n}\n\n\nconst hsync = globalThis.hsync || {\n createConnection: createHsync,\n dynamicConnect,\n net,\n config,\n};\nglobalThis.hsync = hsync;\n\nmodule.exports = hsync;\n\n\n//# sourceURL=webpack://hsync/./hsync-web.js?");
38
+ eval("const mqtt = __webpack_require__(/*! precompiled-mqtt */ \"./node_modules/precompiled-mqtt/dist/mqtt.browser.js\");\nconst buffer = __webpack_require__(/*! buffer */ \"./node_modules/buffer/index.js\");\nconst net = __webpack_require__(/*! net-web */ \"./node_modules/net-web/net-web.js\");\nconst { createHsync, setNet, setMqtt } = __webpack_require__(/*! ./connection */ \"./connection.js\");\nconst config = __webpack_require__(/*! ./config */ \"./config.js\");\n\n// TODO need to make this work with web/service workers\nwindow.Buffer = buffer.Buffer;\n\nsetNet(net);\nsetMqtt(mqtt);\n\nasync function dynamicConnect(dynamicHost, useLocalStorage) {\n let con;\n if (useLocalStorage) {\n const localConfigStr = localStorage.getItem('hsyncConfig');\n if (localConfigStr) {\n const localConfig = JSON.parse(localConfigStr);\n if ((Date.now() - localConfig.created) < (localConfig.timeout * 0.66)) {\n config.hsyncSecret = localConfig.hsyncSecret;\n config.hsyncServer = localConfig.hsyncServer;\n } else {\n localStorage.removeItem('hsyncConfig');\n }\n }\n \n if (!config.hsyncSecret) {\n config.dynamicHost = dynamicHost || config.defaultDynamicHost;\n }\n \n con = await createHsync(config);\n \n if (config.dynamicHost) {\n const storeConfig = {\n hsyncSecret: con.hsyncSecret,\n hsyncServer: con.hsyncServer,\n timeout: con.dynamicTimeout,\n created: Date.now(),\n };\n localStorage.setItem('hsyncConfig', JSON.stringify(storeConfig));\n }\n\n return con;\n }\n\n config.dynamicHost = dynamicHost || config.defaultDynamicHost;\n con = await createHsync(config);\n\n return con;\n \n}\n\n\nconst hsync = globalThis.hsync || {\n createConnection: createHsync,\n dynamicConnect,\n net,\n config,\n};\nglobalThis.hsync = hsync;\n\nmodule.exports = hsync;\n\n\n//# sourceURL=webpack://hsync/./hsync-web.js?");
39
39
 
40
40
  /***/ }),
41
41