Since this api cannot be made sync we should really only have one async api. I've learned from other parts in the pdf.js code that exposing the sync api can lead to problematic code that becomes too dependent on timing when it should have really just been re-written to handle the async operations.

I propose both get() and set() should return promises and wait until the storage is actually read/written to resolve.

As for the singleton: I'd be fine with that or functions on PDFView that would also return promises and do the setting/getting.