UNPKG

@joergmittaglawo/dmvconfig

Version:

DMV Configuration scripts for Lawo V__matrix Distributed Multiviewers.

1 lines 631 B
Object.defineProperty(exports,"__esModule",{value:!0}),exports.ResourceCache=void 0;const e=require("./node_http");exports.ResourceCache=class{constructor(){this.storage={},this.clients={}}async retrieve(t){if(this.storage.hasOwnProperty(t.key))return this.storage[t.key];let s=!1;this.clients.hasOwnProperty(t.key)||(this.clients[t.key]=[],s=!0);const r=new Promise((e,s)=>{this.clients[t.key].push({resolve:e,reject:s})});if(s){try{const s=await e.download_json(t);this.storage[t.key]=s;for(const e of this.clients[t.key])e.resolve(s)}catch(e){for(const s of this.clients[t.key])s.reject(e)}delete this.clients[t.key]}return r}};