Skip to content

Make MainSourceBufferInterface code more readable isolating inner functions - #1569

Merged
peaBerberian merged 1 commit into
devfrom
misc/main-mse_on-error-refacto
Oct 17, 2024
Merged

Make MainSourceBufferInterface code more readable isolating inner functions#1569
peaBerberian merged 1 commit into
devfrom
misc/main-mse_on-error-refacto

Conversation

@peaBerberian

Copy link
Copy Markdown
Collaborator

Note: this was part of the #1413 PR, which was a collection of unrelated improvements. I Chose to open individual pull requests instead so it's easier to review and discuss.


The callback called on the "updateend" and "error" events on a SourceBuffer were previously declared as arrow functions inside the constructor.

This allowed to keep a clear JS context for the this keyword, but it made the MainSourceBufferInterface's constructor harder to read.

I found it more readable to declare both callback as private methods instead, with the drawback of having to bind the this explictely.

…ctions

The callback called on the `"updateend"` and `"error"` events on a
SourceBuffer were previously declared as arrow functions inside the
constructor.

This allowed to keep a clear JS context for the `this` keyword, but it
made the `MainSourceBufferInterface`'s constructor harder to read.

I found it more readable to declare both callback as private methods
instead, with the drawback of having to bind the `this` explictely.
Comment thread src/mse/main_media_source_interface.ts
@peaBerberian
peaBerberian merged commit 1699573 into dev Oct 17, 2024
@peaBerberian peaBerberian added this to the 4.3.0 milestone Nov 18, 2024
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.

2 participants