@tldraw/state
Advanced tools
Comparing version
@@ -61,5 +61,5 @@ "use strict"; | ||
"@tldraw/state", | ||
"3.9.0", | ||
"3.10.0-canary.283889799096", | ||
"cjs" | ||
); | ||
//# sourceMappingURL=index.js.map |
@@ -125,2 +125,16 @@ "use strict"; | ||
} | ||
*[Symbol.iterator]() { | ||
if (this.array) { | ||
for (let i = 0; i < this.arraySize; i++) { | ||
const elem = this.array[i]; | ||
if (typeof elem !== "undefined") { | ||
yield elem; | ||
} | ||
} | ||
} else if (this.set) { | ||
yield* this.set; | ||
} else { | ||
throw new Error("no set or array"); | ||
} | ||
} | ||
has(elem) { | ||
@@ -127,0 +141,0 @@ if (this.array) { |
@@ -25,2 +25,3 @@ "use strict"; | ||
equals: () => equals, | ||
hasReactors: () => hasReactors, | ||
haveParentsChanged: () => haveParentsChanged, | ||
@@ -73,2 +74,10 @@ singleton: () => singleton | ||
const EMPTY_ARRAY = singleton("empty_array", () => Object.freeze([])); | ||
function hasReactors(signal) { | ||
for (const child of signal.children) { | ||
if (child.isActivelyListening) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
//# sourceMappingURL=helpers.js.map |
{ | ||
"name": "@tldraw/state", | ||
"description": "A tiny little drawing app (state).", | ||
"version": "3.9.0", | ||
"version": "3.10.0-canary.283889799096", | ||
"author": { | ||
@@ -58,3 +58,3 @@ "name": "tldraw Inc.", | ||
"dependencies": { | ||
"@tldraw/utils": "3.9.0" | ||
"@tldraw/utils": "3.10.0-canary.283889799096" | ||
}, | ||
@@ -61,0 +61,0 @@ "typedoc": { |
@@ -25,2 +25,2 @@ # @tldraw/state | ||
Have questions, comments or feedback? [Join our discord](https://discord.tldraw.com/?utm_source=github&utm_medium=social&utm_campaign=sociallink). For the latest news and release notes, visit [tldraw.dev](https://tldraw.dev). | ||
Have questions, comments or feedback? [Join our discord](https://discord.tldraw.com/?utm_source=github&utm_medium=readme&utm_campaign=sociallink). For the latest news and release notes, visit [tldraw.dev](https://tldraw.dev). |
@@ -148,2 +148,18 @@ // The maximum size for an array in an ArraySet | ||
*[Symbol.iterator]() { | ||
if (this.array) { | ||
for (let i = 0; i < this.arraySize; i++) { | ||
const elem = this.array[i] | ||
if (typeof elem !== 'undefined') { | ||
yield elem | ||
} | ||
} | ||
} else if (this.set) { | ||
yield* this.set | ||
} else { | ||
throw new Error('no set or array') | ||
} | ||
} | ||
has(elem: T) { | ||
@@ -150,0 +166,0 @@ if (this.array) { |
@@ -98,1 +98,15 @@ import { Child, Signal } from './types' | ||
export const EMPTY_ARRAY: [] = singleton('empty_array', () => Object.freeze([]) as any) | ||
/** | ||
* Does this signal have any active reactors attached to it? When it changes, will it cause anything to run? | ||
* @public | ||
*/ | ||
export function hasReactors(signal: Signal<any>) { | ||
for (const child of signal.children) { | ||
if (child.isActivelyListening) { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
421456
0.91%6881
1.06%1
Infinity%+ Added
- Removed