Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/utils/ast/ast.traverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ export const astTraverse = ({
logger({ time, type: 'push', queue: 'callstack', ast: callExpression });
if (isConsoleExpression(callExpression)) {
// console.log, console.error, console.warn, console.info
logger({ time, type: 'push', queue: 'console', ast: callExpression });
if (callExpression.arguments.length > 1)
throw new Error('Unsupported console argument');
logger({
time,
type: 'push',
queue: 'console',
ast: callExpression.arguments[0],
});
} else if (isPromiseCallbackExpression(callExpression)) {
// promise.resolve.then()
addToQueue({ type: 'microtask', ast: callExpression.arguments[0] });
Expand Down
5 changes: 3 additions & 2 deletions src/utils/calculator/calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ export class Calculator {
render: (time) => {
this.lastRender = time;
this.log({ time, type: 'render' });
while (this.rafCallbacks.length > 0) {
// TODO: exclude infinite loop, when rAF is invoked inside rAF
const count = this.rafCallbacks.length;
// exclude inner callbacks execution in the same step
for (let i = 0; i < count; i++) {
const task = this.rafCallbacks.shift();
if (!task) throw new Error('No raf callback found');
this.log({ time, type: 'shift', queue: 'rafCallback', ast: task });
Expand Down
Loading