tree shake stuff

This commit is contained in:
Kent C. Dodds 2016-06-29 09:49:46 -06:00
parent b25fcb42ca
commit ead26ccab6
3 changed files with 6 additions and 20 deletions

View File

@ -1,5 +1,9 @@
{
"presets": ["es2015", "es2016", "stage-2"],
"presets": [
["es2015", {"modules": false}],
"es2016",
"stage-2"
],
"env": {
"test": {
"plugins": [

View File

@ -1,7 +1,6 @@
import 'todomvc-app-css/index.css'
import View from './view'
import {log} from './helpers'
import Controller from './controller'
import Model from './model'
import Store from './store'
@ -23,5 +22,4 @@ function Todo(name) {
export function onLoad() { // eslint-disable-line import/prefer-default-export
const todo = new Todo('todos-vanillajs')
todo.controller.setView(document.location.hash)
log('view set')
}

View File

@ -1,4 +1,4 @@
export {qs, qsa, log, $on, $delegate, $parent, remove, leftPad}
export {qs, qsa, $on, $delegate, $parent, remove}
// Get element(s) by CSS selector:
function qs(selector, scope) {
@ -9,12 +9,6 @@ function qsa(selector, scope) {
return (scope || document).querySelectorAll(selector)
}
function log(...args) {
if (window.console && window.console.log) {
window.console.log(...args)
}
}
// addEventListener wrapper:
function $on(target, type, callback, useCapture) {
target.addEventListener(type, callback, !!useCapture)
@ -62,16 +56,6 @@ function remove(array, thing) {
array.splice(index, 1)
}
// pad the left of the given string by the given size with the given character
// leftPad('10', 3, '0') -> 010
function leftPad(str, size, padWith) {
if (size <= str.length) {
return str
} else {
return Array(size - str.length + 1).join(padWith || '0') + str
}
}
// Allow for looping on nodes by chaining:
// qsa('.foo').forEach(function () {})
NodeList.prototype.forEach = Array.prototype.forEach