Skip to content
Update dynamic components authored by Michel Smola's avatar Michel Smola
......@@ -9,7 +9,7 @@ const Field = {
labelContainer: null,
valueContainer: null,
init({ onClick, type, label, value }) {
init({ onClick = null, type, label, value }) {
switch (type) {
case 'int':
this.parse = v => parseInt(v, 10);
......@@ -29,7 +29,7 @@ const Field = {
this.valueContainer = DOMore.create('span', { className: 'value', target: this });
this.value = value;
this.addEventListener('click', onClick);
if (onClick) this.addEventListener('click', onClick);
},
value: {
......@@ -66,5 +66,6 @@ const integerField = DOMore.create(Field, {
className: 'integer-field',
type: 'int',
value: 7,
label: 'Integer Field',
});
```
\ No newline at end of file