5

Is there any documentation yet on how locker service fits in with lightning web components? If yes,

  1. What are the implications of locker service on lightning web components?
  2. What are locker service guidelines to work with lightning web components?
5

If you have access to the spring19 pre release org you can explore the documents on the "lightning web components security via locker service" in developer guide. The docs are available for lockerservice @ (YourDomain.lightning.force.com/docs/component-library/documentation/lwc/lwc.security_locker_service)

Lets highlight some key points from document

DOM Access Containment

You cannot use document.querySelector() and the syntax to access the shadow DOM will be this.template.querySelector()

Secure Wrappers

Still you will need SecureWindow, SecureDocument , SecureObject (All these were available in aura locker). On top of it you also have new secure elements SecureLightningElement and SecureTemplate.

SecureLightningElement is a base class that every lightning web component extends from .

SecureTemplate is the shadowRoot node .The docs list which APIS are not supported .

Restrict access to Global Variables

Global variables like $Aura,$A, sfdc and sforce are all restricted .

CSP Support

All Javascript libraries needs to be referenced from static resource and all external images , fonts and CSS needs to use HTTPS .

Except for IE11 ,the locker security principles are applied to the lightning web components as well .

  • 2
    I was about to post the answer but you beat me! Thanks – codeyinthecloud Dec 14 '18 at 14:39
  • Hey! is development guidelines for LWC out? – Dhanik Lal Sahni Dec 18 '18 at 8:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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