Are service workers are supported by lightning components? I am worried that salesforce will not support this feature and alienate Javascript developers.

A service worker is a script that your browser runs in the background, separate from a web page, opening the door to features that don't need a web page or user interaction.

Also, what is the current status to be able to do client http requests? I have found a way around this using bidirectional postMessages and a Visualforce Page embedded as an iframe, then built a listener component to handle the back and forth of request and response.

I also found some issues with the framework around using the set attribute to render another body inside that component, the component will not rerender if the parent objects get changed.

If you look at the aura git repo, there are so many cool components, which salesforce have not even exposed yet.

  • 2
    That's a lot of questions/comments for one question. You might get a better response if you focus on just one question at a time. – martin Mar 7 '17 at 8:36
  • "Service workers" as in JS helper classes or perhaps apex service layer classes called from server side controllers? Your question is very unclear. Keep your question focused and to the point. Visit the Help center and read How do I ask a good question. – crmprogdev Mar 7 '17 at 15:55

According to the Locker Service API SecureWindow, ServiceWorker currently has a status of "Not To Be Supported". While this would be pretty cool to have, it's of pretty limited use in typical scenarios. Perhaps they'll review this in the future.

Contrariwise, XmlHttpRequest is supported in the current Locker Service API. You can use the AJAX Proxy to request documents, but if you're going to use this, you need to make sure that the sites are configured in Remote Site Settings.

As far as using the set method, I suggest you post an example of what you're having problems with. You certainly can set component body and other types of attributes dynamically, but I agree it's not as straightforward as it would be in an insecure library such as jQuery. There's examples in the manuals.

  • Regarding XmlHttpRequest, do I have to use the AJAX proxy, I am pretty sure there is a limit on the size of response. – lodoss118 Mar 8 '17 at 9:54
  • @lodoss118 There's limits if you use Apex Code, but the AJAX Proxy does not have a size limit that I'm aware of. I've previously tested 100,000,000 byte files just to be sure. – sfdcfox Mar 8 '17 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.