Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't update DOM when line didn't change #933

Closed
jcubic opened this issue Apr 24, 2024 · 1 comment
Closed

Don't update DOM when line didn't change #933

jcubic opened this issue Apr 24, 2024 · 1 comment
Labels

Comments

@jcubic
Copy link
Owner

jcubic commented Apr 24, 2024

I have an idea for a new feature for jQuery Terminal

It may improve performance if library don't force update DOM when line didn't changed.

this is the code to update the line with a function on every frame:

    const index = term.last_index();
    (function loop() {
        if (!stop) {
            const new_message = fn();
            if (new_message !== message) {
                message = new_message;
                // update only when value changes
                term.update(index, new_message);
            }
            requestAnimationFrame(loop);
        }
    })();

The code need to check if the value change, we can simplify the user code by do this in the library.

@jcubic jcubic added the feature label Apr 24, 2024
@jcubic
Copy link
Owner Author

jcubic commented Apr 25, 2024

This is already implemented.

@jcubic jcubic closed this as completed Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant