timing-object icon indicating copy to clipboard operation
timing-object copied to clipboard

Can it be used in NodeJS?

Open LamentOfKaito opened this issue 11 months ago • 3 comments

TimingObject is a useful concept/API, but it relies on Web-specific APIs* to work. Other than that, this package is useful outside of brower environments. * Like TNativeEventTarget and event-target-factory.ts

Is it not possible to create a bundle for node where we use a polyfilled version of EventTarget (like https://www.npmjs.com/package/@ungap/event-target) or a different module altogether (node:events or the events package)?

As a side note, in event-target-factory, you are creating a <p> element just to use it as an EventTarget, even though you could create an instance of EventTarget (or a subclass) directly. This should reduce memory allocated and, more importantly, makes the code a little less dependent on the DOM.

See: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/EventTarget

LamentOfKaito avatar Aug 01 '23 11:08 LamentOfKaito