Newer Version Available
Evaluate JavaScript Code Compatibility with Lightning Locker
Let's look at an example that uses a prohibited DOM API.
- Paste this code into the
console.
1var controller = new AbortController(); 2controller; - Click Evaluate.
Note the error in the LOCKER ON column of the results window.
1Error: AbortController is not a constructorYou get this error because AbortController is an experimental interface in the DOM API and is not allowed by Lightning Locker.
The LOCKER OFF column shows N/A as this column isn't relevant when the Locker toggle is enabled.
- Click the Locker toggle to disable Lightning Locker.
- Click Evaluate to rerun the code sample with Lightning Locker
disabled.
The second row of the results window shows there's no longer an error when Lightning Locker is disabled. The LOCKER OFF column shows [object AbortController], which is the return value of the sample code.
Use the Locker API Viewer to see the DOM APIs exposed by Lightning Locker versus the standard DOM APIs for the most complex wrappers: SecureDocument, SecureElement, and SecureWindow.