graphicore / specimenTools

Apache License 2.0
29 stars 5 forks source link

[loadFonts] optionally avoid duplicate XHRs for same files; closes #28 #30

Open graphicore opened 6 years ago

graphicore commented 6 years ago

Supersedes 1969828 in PR #28 by @kontur.

@kontur you can now do something like this:

// Note: I don't mind where you put `globalCache`,
// this is just a really global example.
var globalCache = window.xhrFontCache;
if(!globalCache)
     globalCache = window.xhrFontCache = {};
loadFontsFromUrl(pubsub, fontFiles, globalCache)

Sorry, I didn't test this! I'm waiting for feedback before merging.

kontur commented 6 years ago

I'll try check this out this week/weekend, thanks for this new approach.

kontur commented 6 years ago

Only got around to testing this now, but all works great. Thanks for the review and addition.