Maybe I’ve missed the documentation for this, but in v2 how do you defer a solution from loading so that you can call and initiate later? My use case is that I need to load combobox after CMS Load:
If you look at the home page, the FS solution scripts are in the page head code but the combobox init() call is on an external .js file which is loaded using a script tag in the global footer code. Not sure if this will effect your testing.
I talked with the team, and you can load the solution programmatically at any moment using window.FinsweetAttributes.load('combobox')
Here are some examples:
<script>
// It can be inside the List callback or any other solution
window.FinsweetAttributes = window.FinsweetAttributes || [];
window.FinsweetAttributes.push([
'list',
(listInstances) => {
console.log('List Successfully loaded!');
const [listInstance] = listInstances;
},
]);
// Or you can load the page without any solution and start it like this
window.FinsweetAttributes = window.FinsweetAttributes || [];
window.onload = function () {
console.log('Window has loaded!');
window.FinsweetAttributes.load('combobox');
// do something else
};
</script>
<!-- Finsweet Attributes -->
<script async type="module"
src="https://cdn.jsdelivr.net/npm/@finsweet/attributes@2/attributes.js"
fs-list
></script>
<script>
// It can be inside the List callback or any other solution
window.FinsweetAttributes = window.FinsweetAttributes || [];
window.FinsweetAttributes.push([
'list',
(listInstances) => {
window.FinsweetAttributes.load('combobox');
},
]);
</script>