diff --git a/elements/dat-import.js b/elements/dat-import.js index 97af3c10..c2be850c 100644 --- a/elements/dat-import.js +++ b/elements/dat-import.js @@ -1,6 +1,6 @@ 'use strict' -const microcomponent = require('microcomponent') +const Nanocomponent = require('nanocomponent') const html = require('choo/html') const assert = require('assert') const css = require('sheetify') @@ -60,17 +60,18 @@ const prefix = css` ` function DatImportElement () { - var component = microcomponent({ name: 'dat-import' }) - component.on('render', render) - component.on('update', update) - return component + if (!(this instanceof DatImportElement)) return new DatImportElement() + Nanocomponent.call(this) +} + +DatImportElement.prototype = Object.create(Nanocomponent.prototype) - function render () { - const onsubmit = this.props.onsubmit +DatImportElement.prototype.createElement = function (props) { + const onsubmit = props.onsubmit - assert.equal(typeof onsubmit, 'function', 'dat-import: onsubmit should be type function') + assert.equal(typeof onsubmit, 'function', 'dat-import: onsubmit should be type function') - return html` + return html`