Search code examples
web-workerfacebook-javascript-sdk

Is it possible to use the facebook sdk Inside webworkers?


I want to build a script that builds up the data needed for the application in the background.

I intend to use a web-worker but a lot of the activity use the graph API with JS SDK as it's source and it seems like that ain't working in a webworker.


Solution

  • Yes you can use Facebook's JS SDK inside of Web Workers. Web Workers can use XHR just like regular JavaScript.

    In fact, Web Workers were designed for tasks like this -- offloading data access and other long running requests from the main "UI thread" in favor of background processing.