File size: 501 Bytes
3fbd43b
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
// Demo stand-in for ComfyUI's api.js. Every request goes to the service worker.
const listeners = {};
export const api = {
  clientId: "demo",
  apiURL(p) { return p; }, fileURL(p) { return p; },
  addEventListener(n, f) { (listeners[n] ||= []).push(f); },
  removeEventListener(n, f) { listeners[n] = (listeners[n] || []).filter((x) => x !== f); },
  dispatchEvent() {},
  async fetchApi(route, opts = {}) { return fetch(route.startsWith("/") ? route : "/" + route, opts); },
};
export default api;