Third-party JavaScript libraries in Lightning Components

Salesforce Lightning Component framework provides the ltng:require tag, which allows you to add one or more JavaScript files referenced from Salesforce static resources to Lightning Components. When you use the ltng:require tag, the JavaScript loaded has the ability to manipulate the DOM within the component's boundaries.

In this section, we will take a third-party JavaScript library called flipclock.js to build a Lightning Component that displays a flipclock. Note that flipclock.js is completely compatible with locker and hence we do not need any modifications to the original library source code. Later, in the Creating a Locker Service-compliant JavaScript bundle using webpack section, we will take an example where libraries are not compatible with locker and understand the general process to make them compatible with locker.

Before we deep dive into its usage, let's look at some of the attributes and events provided by the ltng:require tag.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.75.70