A music player that connects to your cloud/distributed storage.
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: allow search processor to be shared

+15 -11
+1 -4
src/component/engine/audio/element.js
··· 23 23 constructor() { 24 24 super(); 25 25 26 - // Is shared? 27 - const isShared = this.hasAttribute("group"); 28 - 29 26 // Setup leader election if shared 30 - if (isShared) { 27 + if (this.hasAttribute("group")) { 31 28 const fn = this.broadcast(`diffuse/engine/audio/${this.group}`); 32 29 33 30 this.pause = fn("pause", this.pause).leaderOnly;
+1 -4
src/component/engine/queue/element.js
··· 17 17 constructor() { 18 18 super(); 19 19 20 - // Is shared? 21 - const isShared = this.hasAttribute("group"); 22 - 23 20 // Setup worker 24 21 const name = `diffuse/engine/queue/${this.group}`; 25 22 const url = "/component/engine/queue/worker.js"; 26 23 27 24 let port; 28 25 29 - if (isShared) { 26 + if (this.hasAttribute("group")) { 30 27 const worker = new SharedWorker(url, { name, type: "module" }); 31 28 port = worker.port; 32 29 port.start();
+13 -3
src/component/processor/search/element.js
··· 19 19 // Setup worker 20 20 const name = `diffuse/processor/search/${this.group}`; 21 21 const url = "/component/processor/search/worker.js"; 22 - const worker = new Worker(url, { name, type: "module" }); 22 + 23 + let port; 24 + 25 + if (this.hasAttribute("group")) { 26 + const worker = new SharedWorker(url, { name, type: "module" }); 27 + port = worker.port; 28 + port.start(); 29 + } else { 30 + const worker = new Worker(url, { name, type: "module" }); 31 + port = worker; 32 + } 23 33 24 34 // Worker proxy 25 - this.search = use("search", worker); 26 - this.supply = use("supply", worker); 35 + this.search = use("search", port); 36 + this.supply = use("supply", port); 27 37 } 28 38 } 29 39