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

Use of async makes things difficult. Use promises instead. #71

Open
bendavis78 opened this issue Jan 19, 2020 · 1 comment
Open

Use of async makes things difficult. Use promises instead. #71

bendavis78 opened this issue Jan 19, 2020 · 1 comment

Comments

@bendavis78
Copy link

bendavis78 commented Jan 19, 2020

I'm trying to use this in conjunction with printedjs, but it doesn't work because this library manipulates dom in a setTimeout(). Is there a good reason this needs to be wrapped in a setTimeout? If so, why not use promises? That would give us more control over the situation.

@T3sT3ro
Copy link

T3sT3ro commented Dec 4, 2022

I modified the code and replaced current implementation with the following in my script:

function lineNumbersBlock (element, options) {
    if (typeof element !== 'object') return;

    return new Promise((resolve, reject) => {
        element.innerHTML = lineNumbersInternal(element, options);
        resolve();
    })
}

and it forks for me ¯\_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants