From 55ffa935c3ce953795dfc665d8f8701178173ab3 Mon Sep 17 00:00:00 2001 From: Ashok Date: Sat, 13 Jan 2018 00:23:47 +0530 Subject: [PATCH 01/18] replace microcomponent with nanocomponent --- elements/dat-import.js | 37 ++-- elements/download.js | 69 +++---- elements/file-list.js | 91 +++++---- elements/header.js | 138 ++++++------- elements/inspect.js | 49 ++--- elements/intro.js | 90 ++++----- elements/sprite.js | 36 ++-- elements/status-bar.js | 28 +-- elements/table-row.js | 368 +++++++++++++++++----------------- elements/table-title-field.js | 162 +++++++-------- elements/table.js | 29 +-- package-lock.json | 59 +++++- package.json | 2 +- 13 files changed, 613 insertions(+), 545 deletions(-) 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`