-
Notifications
You must be signed in to change notification settings - Fork 5
Usage in web workers #12
Comments
Ok so I went through the code myself and made it so that the Here are the changes I made: The three important changes are: 1. You can pass in a "dataStore connection" via the optionsconst dataStoreConnection = (
opts.ds ? Promise.resolve(opts.ds) : datastoreMountOrCreate()
); This connection is passed down to all the functions that also need a dataStore connection. 2. Exported additional functionsThat is, 3. Use the dataStoreConnection in more places// old code
options['headers'] = {'Authorization': `bearer ${getSessionToken()}`}
// new code
options['headers'] = {'Authorization': `bearer ${ds.session_token}`} Let me know what you think. If these changes are ok then I can make them for all functions and setup a PR. ✌️ |
Awesome work! Thanks for taking a look at this! The only concern I have is this:
I need to think more about the implications of loading |
Thanks! Ok cool, let me know if there could be another way to avoid calling And no, web workers know next to nothing about the main thread. It's not really convenient, but it's the only way I know to make sure that my UI doesn't block ¯_(ツ)_/¯ (Although it still blocks for a second, sadly 😞 But it's way better than before) |
How close are you to completing that multiplayer storage @jcnelson ? I was cleaning up the datastore.js file a bit, but I should probably wait until you're done with that multiplayer storage 🤔 |
It's hard to say a precise date (we just wrote up some notes on the near-term storage engineering goals here: https://github.com/blockstack/blockstack/blob/master/meeting-notes/2017-08-01-storage.md). |
Hmm ok. I'll rebase this work here on that multiplayer branch and I'll continue working on that. Then I can also start using that fileUrl thing you wrote. I'm also going to split up that datastore.js file, because it's pretty overwhelming 😅 Sound good? |
Actually, I'd appreciate it if you didn't at this time. There's a good chance that we're going to be removing a lot of code from it anyway, as part of adding multi-player storage. We can break it apart then :) |
@jcnelson Aight cool. Let me know ;) |
Hey folks 👋
I was wondering if there was a way to use this library (or blockstack.js) in a web worker. The issue I'm having is that each time I store my application state, the browser hangs because the state is so large and the storing process is executed in the same thread. So I tried to do a
blockstack.putFile
inside a web worker, but that doesn't work because putFile accesses thelocalStorage
.Thoughts?
The text was updated successfully, but these errors were encountered: