flipperbw / FantasyPlus

Adds FantasyPros projections to fantasy football sites.
Mozilla Public License 2.0
88 stars 38 forks source link

Use local storage to avoid waiting for rules to reload every page reload #3

Closed jscott0918 closed 10 years ago

jscott0918 commented 10 years ago

Hopefully this will result in less upfront network traffic waiting for rules to reload.

Rumel commented 10 years ago

:+1:

trippedout commented 10 years ago

itd be cooler if you used:

chrome.storage.sync.get('league_settings', function(settings)
{
    //if empty, make request for settings
    if($.isEmptyObject(settings))
    {
        $.get('http://games.espn.go.com/ffl/leaguesetup/sections/scoring', {"leagueId": league_id}, function(d) {
            parse_data(d);
        }); 
    }
    else //push settings local
    {
        window.league_settings = settings['league_settings'];
        getPosProjections();
    }
});

reference: https://github.com/trippedout/FantasyPlus/commit/d233d568d1892db14a1561f0ffc8f9467ef129bb

so that we can keep it synced across our devices/browsers :D

flipperbw commented 10 years ago

Hmmm...is it possible to combine these two? In @jscott0918 version, I think getPosProjections can actually execute before the data is parsed the first time, but it has the added benefit of checking for updated league settings. I don't want it to redraw on that second check. But @trippedout seems a bit cleaner, though without ever changing it in the future. Any ideas? I haven't had my coffee yet today.