diff options
| author | bobzel <zzzman@gmail.com> | 2024-10-10 20:06:17 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2024-10-10 20:06:17 -0400 |
| commit | 962302d41ba5b086818f5db9ea5103c1e754b66f (patch) | |
| tree | fe7b36ce2ac3c8276e4175e4dd8d5e223e1373a7 /src/client/util | |
| parent | 3a35e2687e3c7b0c864dd4f00b1002ff088b56d3 (diff) | |
| parent | 040a1c5fd3e80606793e65be3ae821104460511b (diff) | |
Merge branch 'master' into alyssa-starter
Diffstat (limited to 'src/client/util')
| -rw-r--r-- | src/client/util/DocumentManager.ts | 5 | ||||
| -rw-r--r-- | src/client/util/Scripting.ts | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts index 5ae292760..4ab2e8d05 100644 --- a/src/client/util/DocumentManager.ts +++ b/src/client/util/DocumentManager.ts @@ -45,6 +45,7 @@ export class DocumentManager { DocumentView.addViewRenderedCb = this.AddViewRenderedCb; DocumentView.getFirstDocumentView = this.getFirstDocumentView; DocumentView.getDocumentView = this.getDocumentView; + DocumentView.getDocViewIndex = this.getDocViewIndex; DocumentView.getContextPath = DocumentManager.GetContextPath; DocumentView.getLightboxDocumentView = this.getLightboxDocumentView; observe(Doc.CurrentlyLoading, change => { @@ -140,6 +141,10 @@ export class DocumentManager { ); } + public getDocViewIndex(target: Doc): number { + return DocumentManager.Instance.DocumentViews.findIndex(dv => dv.Document === target); + } + public getLightboxDocumentView = (toFind: Doc): DocumentView | undefined => { const views: DocumentView[] = []; DocumentManager.Instance.DocumentViews.forEach(view => DocumentView.LightboxContains(view) && Doc.AreProtosEqual(view.Document, toFind) && views.push(view)); diff --git a/src/client/util/Scripting.ts b/src/client/util/Scripting.ts index c7b86815a..b1db0bf39 100644 --- a/src/client/util/Scripting.ts +++ b/src/client/util/Scripting.ts @@ -186,7 +186,7 @@ export function CompileScript(script: string, options: ScriptOptions = {}): Comp if (captureVal instanceof Array) return p + captureVal.map(formatCapture); return p + formatCapture(captured[v]); }, ''); - const found = ScriptField.GetScriptFieldCache(script + ':' + signature); + const found = ScriptField.GetScriptFieldCache(script + ':' + signature); // if already compiled, found is the result; cache set below if (found) return found as CompiledScript; const { requiredType = '', addReturn = false, params = {}, capturedVariables = {}, typecheck = true } = options; if (options.params && !options.params.this) options.params.this = Doc.name; |
