SteamGridDB / steam-rom-manager

An app for managing ROMs in Steam
GNU General Public License v3.0
1.83k stars 119 forks source link

Move image providers from main thread to web workers #25

Closed FrogTheFrog closed 7 years ago

FrogTheFrog commented 7 years ago

Should reduce app stutter and allow to implement more performance inpacting image providers in the future.

Todo list:

HEspoke commented 7 years ago

I have been working with the creator of SteamGridDB that you reference on your github landing page for SRM. I spent yesterday uploading my grid images and labeling them successfully. If there are any grid images that don't populate and you think that the 'title' is correct then let me know and I can look into it. Great work as always, keep it up @FrogTheFrog

FrogTheFrog commented 7 years ago

Finally got a generic structure for retrieving image data in a web worker:

import { GenericProvider, GenericProviderManager } from "./generic-provider";

class SteamGridDbProvider extends GenericProvider {
    retrieveUrls() { //Entry point
        console.log('Do stuff here with ', this.proxy.title);

        if (this.proxy.filter){
            //Filter titles
            this.proxy.fuzzyMatcher.fuzzyEqual(...)
        }

        this.proxy.error(...); //Notify about error
        this.proxy.image(...); //Send image data
        this.proxy.timeout(...); //Send timeout request

        this.proxy.completed(); //Done retrieving data
    }

    stopUrlDownload() {
        console.log('User wants to abort. Ignore user or stop everything and call "this.proxy.completed"');
    }
}

new GenericProviderManager(SteamGridDbProvider);