INNER CODE UNIT · TypeScript
lastSize
Dakkshin/after-effects-mcp · src/index.ts:81
let lastSize = -1;
while (Date.now() - start < timeoutMs) {
if (fs.existsSync(resultPath)) {
try {
const content = fs.readFileSync(resultPath, 'utf8');
if (content && content.length > 0 && content.length !== lastSize) {
lastSize = content.length;
try {
const parsed = JSON.parse(content);
if (!expectedCommand || parsed._commandExecuted === expectedCommand) {
return content;
}
} catch {
// not JSON yet; continue polling
}
}
} catch {