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

rewrite: "v2" #128

Closed
wants to merge 6 commits into from
Closed

rewrite: "v2" #128

wants to merge 6 commits into from

Conversation

ThaUnknown
Copy link

@ThaUnknown ThaUnknown commented Feb 20, 2022

This is a full rewrite of the JS of JSSO, meaning it includes breaking changes, hence the 'v2'.

I have used ES2020, but that can easily be compiled down by the user with the likes of babel or other, I however didn't force any reliance on new API's, nor have I removed any backwards compatibility, which means this [hopefully, pls check @dmitrylyzo ] should still run on any legacy browsers [after compiling using babel]. Maybe we could additionally provide a version of JSSO which is already babel'ed so the user doesn't have to do it? That's another topic.

I changed a lot of things, which means more can be changed. If you think something should be further changed, please say so.

The README still needs to be updated, but that always comes last.

The reason it's a single commit is because it was a full rewrite, rather than bit by bit patching, and since there's a "no broken commits" policy here, this is the only way I could imagine of doing it.

In general this is focused on performance, performance, performance [where it matters] and bugfixes.

Overview:

Structure:

Features:

Performance/bugs:

Test link: https://thaunknown.github.io/JavascriptSubtitlesOctopus/ts

@TFSThiagoBR98
Copy link
Collaborator

I have used ES2020, but that can easily be compiled down by the user with the likes of babel or other, I however didn't force any reliance on new API's, nor have I removed any backwards compatibility, which means this [hopefully, pls check @dmitrylyzo ] should still run on any legacy browsers [after compiling using babel]. Maybe we could additionally provide a version of JSSO which is already babel'ed so the user doesn't have to do it? That's another topic.

Isn't it better to include babel and eslint as devDependencies and compile it along with the worker, instead of include the compiled version.

@ThaUnknown
Copy link
Author

I have used ES2020, but that can easily be compiled down by the user with the likes of babel or other, I however didn't force any reliance on new API's, nor have I removed any backwards compatibility, which means this [hopefully, pls check @dmitrylyzo ] should still run on any legacy browsers [after compiling using babel]. Maybe we could additionally provide a version of JSSO which is already babel'ed so the user doesn't have to do it? That's another topic.

Isn't it better to include babel and eslint as devDependencies and compile it along with the worker, instead of include the compiled version.

Most likely, yes. But that's outside of the scope of this PR, I'd rather focus on the functionality/code

@ThaUnknown
Copy link
Author

ThaUnknown commented Feb 20, 2022

I put up a "small" test case for this, ~300-500 bitmaps per frame, on firefox this is likely to crash, runs fine on chrome tho
https://thaunknown.github.io/JavascriptSubtitlesOctopus/ts

@heyaco
Copy link

heyaco commented Feb 20, 2022

@ThaUnknown subs do not show in fullscreen mode

@ThaUnknown
Copy link
Author

@ThaUnknown subs do not show in fullscreen mode

use f11, not video controls

@ThaUnknown
Copy link
Author

updated example video with some CSS animation showcases

src/post-worker.js Outdated Show resolved Hide resolved
@ThaUnknown
Copy link
Author

@TFSThiagoBR98 @dmitrylyzo @TheOneric does anything need to be changed for this PR for it to be reviewed? At most I could add URLs to code snippets of the fixes/features if thats required

@TFSThiagoBR98
Copy link
Collaborator

TFSThiagoBR98 commented Feb 21, 2022

If possible, can you add JSDoc comments to subtitle-octopus.js? I'll use that to generate the definition files for #95.

At most I could add URLs to code snippets of the fixes/features if thats required.

That may help

@ThaUnknown
Copy link
Author

If possible, can you add JSDoc comments to subtitle-octopus.js? I'll use that to generate the definition files for #95.

this is some of the least fun stuff I've ever done

@ThaUnknown
Copy link
Author

That may help

added code snippets to wherever it was possible

@ThaUnknown ThaUnknown marked this pull request as ready for review February 25, 2022 17:38
src/post-worker.js Outdated Show resolved Hide resolved
src/post-worker.js Outdated Show resolved Hide resolved
@ThaUnknown
Copy link
Author

@TFSThiagoBR98 @TheOneric I've pulled upstream, resolved conflicts

is there anything to be done to get this PR to move, or is it simply a case of "this PR is trying to do too much" and noone is willing to review it?

@ThaUnknown
Copy link
Author

additionally this PR is a fix to #46 [as the renderer won't request more subtitles under load], partial fix to #72 [perf optimisations], full fix to #97 [as onDemandRender doesn't use event listeners, and destory() removes listeners], partial fix to 1001432683[as you can use _demandRender, omitting JSO's render loop], and partial fix to #8 [only for ondemand render]

@TheOneric
Copy link
Member

The patch requirements have been explained before and serve to ensure long-term maintainability and reducing the chance of new bugs slipping in. Reducing them to "no broken commits" is leaving out several key points. Most notably this fails at not bundling logically unrelated changes and proper documentation. Some of the listed changes also appear to have API implications. The list in OP with pointers to individual code section strongly indicates, that a separation is very much possible.

@ThaUnknown
Copy link
Author

The patch requirements have been explained before and serve to ensure long-term maintainability and reducing the chance of new bugs slipping in. Reducing them to "no broken commits" is leaving out several key points. Most notably this fails at not bundling logically unrelated changes and proper documentation. Some of the listed changes also appear to have API implications. The list in OP with pointers to individual code section strongly indicates, that a separation is very much possible.

while separation is possible, this means loosing functionality in the initial PRs as i didn't modify JSO, but deleted all of it and started from 0, for my own sanity

are you okay with PRs like that?

@TheOneric
Copy link
Member

There must be “no temporary user-visible behaviour changes” (and permanent changes need to be justified). Start from the existing code and change it one step to be review- and understandable.

@ThaUnknown
Copy link
Author

There must be “no temporary user-visible behaviour changes” (and permanent changes need to be justified). Start from the existing code and change it one step to be review- and understandable.

I don't see how that can happen with a full rewrite of the JS part of the library

to put it simply the current js is close to unmaintainable, be because it was made from a fork of a fork of a library, you even have some of the original libassjs code in here, taking the code apart like that to make massive changes will take weeks

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

Successfully merging this pull request may close these issues.

5 participants