Giter Site home page Giter Site logo

Comments (6)

killje avatar killje commented on May 21, 2024

Alpha build available through:
https://github.com/greasemonkey/greasemonkey/releases

from maia-yt.

YePpHa avatar YePpHa commented on May 21, 2024

Interesting. I will need to do a few changes for how I handle saving and loading settings.

The main part that I need to revisit for this to work correctly is to probably make the synchronous parts of the modules accept asynchronous responses. This needs to be handled in the core code where I intercept the yt.player.Application.create method. Moreover that method is a synchronous method and things might break if the player is not created immediately after the method is called.

It might be possible to not use asynchronous code in the modules and instead cache the settings. I will need to experiment with this before I can decide on which way to go.

from maia-yt.

Yonezpt avatar Yonezpt commented on May 21, 2024

@YePpHa So far the only one that needs to be asynchronous (or at least behaves as such) is the *.getValue method and the timing is not noticeable while trying to do the first interceptions. I've made a GM 3.* / 4 make-shift poly-fill here if it helps:

https://github.com/ParticleCore/Iridium/blob/40545039a9b29f9477a6f4fe24e3588efc2a8c8b/src/userscript/Iridium.user.js#L5602-L5630

and the new use for *.getValue

https://github.com/ParticleCore/Iridium/blob/40545039a9b29f9477a6f4fe24e3588efc2a8c8b/src/userscript/Iridium.user.js#L5573-L5581

Decided not to make use of await since it required making the entire script async from what I gathered.

from maia-yt.

YePpHa avatar YePpHa commented on May 21, 2024

@Yonezpt I've decided to try out making Maia asynchronous as it would be the most ideal thing. I might also just scrap making it asynchronous and preload all settings and let the handlePlayerCreate method wait for it to preload before starting. It really depends on if I experience some show stopper due to async interacting with a sync environment.

I've been experimenting with making Maia asynchronous and it works for the most part. I haven't been able to change everything as the API calls to the YouTube player are all synchronous. If I want to intercept them I can't do that asynchronous except if I don't need to return a value. That means some of the API calls I can intercept asynchronous and some I can't. The good news is that the current API calls I intercept can be asynchronous.

The preventing of player events are not working in the async environment due to the current event system in Maia being synchronous as it's based on the DOM events.

Branch: https://github.com/YePpHa/maia-yt/tree/async

Test build with support for GreaseMonkey v4:
maia.user.js.zip

from maia-yt.

YePpHa avatar YePpHa commented on May 21, 2024

Okay, I've done some more tests. I've decided to not make Maia asynchronous as it introduces unneeded complexity in translating between synchronous and asynchronous environments.

What I will do instead is to preload the storage for each module and prevent yt.player.Application.create from starting before it has completed the preload.

from maia-yt.

YePpHa avatar YePpHa commented on May 21, 2024

I've implemented GM4 in v0.1.9.

from maia-yt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.