Define JS Constant Data
JS constant data will execute only first time when page load . To define JS constant data, follow the steps below:
1. Create A JS File
Create a JS file to store JS constant data:
constant/constant.jsconsole.log("Hello ProposeJS");
2. Update the propose.json File
Make a proposal for JS constant data in the propose.json file:
/propose.json{
"js": {
"constant": ["/constant/constant.js"]
}
}
Note
- JS constant data will execute first time when page load
- JS constant data should use targetting HTML constant content
- It's possible to make multiple proposals for JS constant data.
- JS constant data will execute every time when state change or load.