Skip to content

Dev Suggestions #137

Open
Open
@fire332

Description

@fire332

EDITED March 29

I've accumulated a list of minor suggestions/issues about the repo that I haven't gotten around to or don't feel appropriate to make a PR without some discussion.

  • The build script needs to have --mode=production appended so that the bundle will actually be optimized during the GH release workflow. Consequently, there probably should be a build:dev script for convenience.
  • Since top-level await has been supported by webpack by default since 5.83.0, this IIFE wrapper can be removed but testing is needed.
  • Instead of using timers to determine when to skip in the sponsorblock code, we can check a list of ranges in a <video> timeupdate event listener. Using timers seems error prone and hard to update from a programming standpoint if we want to add features to the sponsorblock code.
  • I've noticed the .vscode folder is now gitignore'ed. Is it intentional that the .vscode folder is not deleted from the repo? I've originally made a PR adding that folder for developer convenience but I don't know about @throwaway96's thoughts on that.
    • Addressed below.
  • It's probably possible to make a script to launch chrome with the correct user agent and the userscript loaded as an extension via Playwright. This will make local testing easier. If there's interest, I can make a PR about this.
  • If there's interest, I can convert the code to TypeScript in a PR.
  • The domrect and spatial-navigation polyfills can be converted to patched dependencies to clarify the changes performed. Yarn and pnpm support patching dependencies natively, and patch-package can be used for npm.
  • @throwaway96 to reply to your comment here, waitForChildAdd could take a required arg to determine whether or not to observe attribute mutations which will maintain the principle of least surprise. The signature change will be as follows:
// FROM
declare async function waitForChildAdd(parent: Element, predicate: () => boolean, abortSignal?: AbortSignal);

// TO
declare async function waitForChildAdd(parent: Element, predicate: () => boolean, observeAttributes: boolean abortSignal?: AbortSignal);

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions