I’m trying to create a Javascript component that I can simply ‘include’ on a page and it basically outputs a form. I will probably use Handlebars templates within my component.
However, I’m struggling with how best to structure the configuration of my component I thought of some how passing it in like:
<script src = “my-component.js”>
var config = {
key1: ‘whatever’,
key2: ‘whatever'
}
</script>
...But how could I then get hold of my config object, within my-component.js?
Is there a more preferred approac
Aucun commentaire:
Enregistrer un commentaire