Pro only MV2Background Libraries
Background libraries are executed everytime the extension is loaded (when the browser starts, or when you reload / update the extension).
These libraries are executed in the background script of the extension, and are isolated from any webpage, browser tab or window. They also don't have access to DOM elements or anything that is web page related.
Background libraries are useful to extend the functionality of your custom codes by providing helper functions or additional generator sources.
Fake Data comes bundled with two background libraries: Faker and Moment.js.
Keep in mind that background libraries are loaded in the global scope and they also have access to any chrome.* API. So make sure you know what files you are uploading.
How to load a Background library
In order to load a background library into Fake Data, please follow these steps
- Open Fake Data's options page.
- Go to Settings -> Developer Options -> Loaded Libraries -> Background Libraries.
- Click on Choose File and select your .js file from your computer, then press on the green button to upload it.
Below is a demo video showing how to upload a background library and how to use it in a Custom Generator:
A broken background library might cause Fake Data to not work properly if errors are thrown. If you experience any issue after adding a library, remove it and reload the extension.