remove _deffer (#3114)

* remove _deffer

Signed-off-by: Paul Tagliamonte <paul@zoo.dev>
This commit is contained in:
Paul Tagliamonte
2024-07-23 20:37:04 -04:00
committed by GitHub
parent a68748abcf
commit 22df47fa96
10 changed files with 11 additions and 33 deletions

View File

@ -38,22 +38,6 @@ export class KclManager {
private _wasmInitFailed = true
engineCommandManager: EngineCommandManager
private _defferer = deferExecution((code: string) => {
const ast = this.safeParse(code)
if (!ast) {
this.clearAst()
return
}
try {
const fmtAndStringify = (ast: Program) =>
JSON.stringify(parse(recast(ast)))
const isAstTheSame = fmtAndStringify(ast) === fmtAndStringify(this._ast)
if (isAstTheSame) return
} catch (e) {
console.error(e)
}
this.executeAst(ast)
}, 600)
private _isExecutingCallback: (arg: boolean) => void = () => {}
private _astCallBack: (arg: Program) => void = () => {}
@ -331,10 +315,8 @@ export class KclManager {
this._cancelTokens.set(key, true)
})
}
async executeCode(force?: boolean, zoomToFit?: boolean): Promise<void> {
// If we want to force it we don't want to defer it.
if (!force) return this._defferer(codeManager.code)
async executeCode(zoomToFit?: boolean): Promise<void> {
console.log('[kcl/KclSingleton] executeCode')
const ast = this.safeParse(codeManager.code)
if (!ast) {
this.clearAst()