fix esbuild warnings

This commit is contained in:
Stewart Allen 2025-06-25 23:05:13 -04:00
commit 2bb5a2399e
3 changed files with 17 additions and 16 deletions

1
app.js
View file

@ -427,6 +427,7 @@ function initModule(mod, file, dir) {
logger: log.new logger: log.new
}, },
inject: (code, file, opt = {}) => { inject: (code, file, opt = {}) => {
console.log({ inject: opt, code, file });
let codelist = script[code]; let codelist = script[code];
if (!codelist) { if (!codelist) {
return logger.log(`inject missing target "${code}"`); return logger.log(`inject missing target "${code}"`);

View file

@ -435,10 +435,6 @@ export class Point {
return this === p || (this.x === p.x && this.y === p.y && this.z === p.z); return this === p || (this.x === p.x && this.y === p.y && this.z === p.z);
} }
isEqual2D(p) {
return this === p || (this.x === p.x && this.y === p.y);
}
/** /**
* returns true if points are close enough to be considered equivalent * returns true if points are close enough to be considered equivalent
*/ */

View file

@ -1,10 +1,10 @@
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */ /** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
class Broker { class Broker {
debug = false; #debug = false;
topics = {}; #topics = {};
used = {}; #used = {};
send = {}; #send = {};
constructor() { constructor() {
// using the pattern "broker.send(msg)" induces runtime errors // using the pattern "broker.send(msg)" induces runtime errors
@ -14,7 +14,11 @@ class Broker {
} }
topics() { topics() {
return Object.keys(this.topics); return Object.keys(this.#topics);
}
get send() {
return this.#send;
} }
// create subscriptions for all functions in an object // create subscriptions for all functions in an object
@ -45,13 +49,13 @@ class Broker {
// console.trace({invalid_topic: topic}); // console.trace({invalid_topic: topic});
return; return;
} }
let topics = this.topics; let topics = this.#topics;
let channel = topics[topic]; let channel = topics[topic];
if (!channel) { if (!channel) {
channel = topics[topic] = []; channel = topics[topic] = [];
} }
if (channel.indexOf(listener) < 0) { if (channel.indexOf(listener) < 0) {
let send = this.send; let send = this.#send;
let name = topic.replace(/[\\ \.-]/g, '_'); let name = topic.replace(/[\\ \.-]/g, '_');
send[name] = send[name] = this.bind(topic); send[name] = send[name] = this.bind(topic);
channel.push(listener); channel.push(listener);
@ -61,7 +65,7 @@ class Broker {
} }
unsubscribe(topic, listener) { unsubscribe(topic, listener) {
let channel = this.topics[topic]; let channel = this.#topics[topic];
if (!channel) { if (!channel) {
return; return;
} }
@ -71,7 +75,7 @@ class Broker {
} }
channel.splice(index,1); channel.splice(index,1);
if (channel.length === 0) { if (channel.length === 0) {
delete this.topics[topic]; delete this.#topics[topic];
this.publish(".topic.remove", topic); this.publish(".topic.remove", topic);
} }
} }
@ -86,13 +90,13 @@ class Broker {
if (topic !== ".topic.publish") { if (topic !== ".topic.publish") {
this.publish(".topic.publish", {topic, message, options}); this.publish(".topic.publish", {topic, message, options});
} }
if (this.debug && !topic.startsWith(".")) { if (this.#debug && !topic.startsWith(".")) {
console.log({ topic, message }); console.log({ topic, message });
} }
// store last seen message on a topic // store last seen message on a topic
// acts as a tracker for all used topics // acts as a tracker for all used topics
this.used[topic] = message; this.#used[topic] = message;
let channel = this.topics[topic]; let channel = this.#topics[topic];
if (channel && channel.length) { if (channel && channel.length) {
for (let listener of channel) { for (let listener of channel) {
try { try {