cafe-utility 22.4.0 → 23.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +5 -0
- package/index.js +34 -16
- package/module.mjs +1 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -538,6 +538,11 @@ declare function findLines(grid: Truthy[][], tileSize: number): Line[];
|
|
|
538
538
|
declare function getLineIntersectionPoint(line1Start: Point, line1End: Point, line2Start: Point, line2End: Point): Point | null;
|
|
539
539
|
declare function raycast(origin: Point, lines: Line[], angle: number): Point | null;
|
|
540
540
|
declare function raycastCircle(origin: Point, lines: Line[], corners: Point[]): Point[];
|
|
541
|
+
export declare class PubSubChannel<T> {
|
|
542
|
+
private subscribers;
|
|
543
|
+
subscribe(callback: (data: unknown) => void): () => void;
|
|
544
|
+
publish(data: T): void;
|
|
545
|
+
}
|
|
541
546
|
export declare const Binary: {
|
|
542
547
|
hexToUint8Array: typeof hexToUint8Array;
|
|
543
548
|
uint8ArrayToHex: typeof uint8ArrayToHex;
|
package/index.js
CHANGED
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, '__esModule', { value: !0 }),
|
|
|
13
13
|
exports.Arrays =
|
|
14
14
|
exports.Random =
|
|
15
15
|
exports.Binary =
|
|
16
|
+
exports.PubSubChannel =
|
|
16
17
|
exports.Optional =
|
|
17
18
|
void 0)
|
|
18
19
|
async function invertPromise(n) {
|
|
@@ -2347,22 +2348,39 @@ function raycastCircle(n, t, e) {
|
|
|
2347
2348
|
}
|
|
2348
2349
|
return i
|
|
2349
2350
|
}
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
}
|
|
2351
|
+
class PubSubChannel {
|
|
2352
|
+
constructor() {
|
|
2353
|
+
this.subscribers = []
|
|
2354
|
+
}
|
|
2355
|
+
subscribe(t) {
|
|
2356
|
+
return (
|
|
2357
|
+
this.subscribers.push(t),
|
|
2358
|
+
() => {
|
|
2359
|
+
this.subscribers = this.subscribers.filter(e => e !== t)
|
|
2360
|
+
}
|
|
2361
|
+
)
|
|
2362
|
+
}
|
|
2363
|
+
publish(t) {
|
|
2364
|
+
this.subscribers.forEach(e => e(t))
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
;(exports.PubSubChannel = PubSubChannel),
|
|
2368
|
+
(exports.Binary = {
|
|
2369
|
+
hexToUint8Array,
|
|
2370
|
+
uint8ArrayToHex,
|
|
2371
|
+
base64ToUint8Array,
|
|
2372
|
+
uint8ArrayToBase64,
|
|
2373
|
+
log2Reduce,
|
|
2374
|
+
partition,
|
|
2375
|
+
concatBytes,
|
|
2376
|
+
merkleStart,
|
|
2377
|
+
merkleAppend,
|
|
2378
|
+
merkleFinalize,
|
|
2379
|
+
numberToUint64LE,
|
|
2380
|
+
uint64LEToNumber,
|
|
2381
|
+
numberToUint64BE,
|
|
2382
|
+
uint64BEToNumber
|
|
2383
|
+
}),
|
|
2366
2384
|
(exports.Random = {
|
|
2367
2385
|
intBetween,
|
|
2368
2386
|
floatBetween,
|
package/module.mjs
CHANGED