tree shake stuff
This commit is contained in:
parent
b25fcb42ca
commit
ead26ccab6
6
.babelrc
6
.babelrc
@ -1,5 +1,9 @@
|
|||||||
{
|
{
|
||||||
"presets": ["es2015", "es2016", "stage-2"],
|
"presets": [
|
||||||
|
["es2015", {"modules": false}],
|
||||||
|
"es2016",
|
||||||
|
"stage-2"
|
||||||
|
],
|
||||||
"env": {
|
"env": {
|
||||||
"test": {
|
"test": {
|
||||||
"plugins": [
|
"plugins": [
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import 'todomvc-app-css/index.css'
|
import 'todomvc-app-css/index.css'
|
||||||
|
|
||||||
import View from './view'
|
import View from './view'
|
||||||
import {log} from './helpers'
|
|
||||||
import Controller from './controller'
|
import Controller from './controller'
|
||||||
import Model from './model'
|
import Model from './model'
|
||||||
import Store from './store'
|
import Store from './store'
|
||||||
@ -23,5 +22,4 @@ function Todo(name) {
|
|||||||
export function onLoad() { // eslint-disable-line import/prefer-default-export
|
export function onLoad() { // eslint-disable-line import/prefer-default-export
|
||||||
const todo = new Todo('todos-vanillajs')
|
const todo = new Todo('todos-vanillajs')
|
||||||
todo.controller.setView(document.location.hash)
|
todo.controller.setView(document.location.hash)
|
||||||
log('view set')
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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:
|
// Get element(s) by CSS selector:
|
||||||
function qs(selector, scope) {
|
function qs(selector, scope) {
|
||||||
@ -9,12 +9,6 @@ function qsa(selector, scope) {
|
|||||||
return (scope || document).querySelectorAll(selector)
|
return (scope || document).querySelectorAll(selector)
|
||||||
}
|
}
|
||||||
|
|
||||||
function log(...args) {
|
|
||||||
if (window.console && window.console.log) {
|
|
||||||
window.console.log(...args)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// addEventListener wrapper:
|
// addEventListener wrapper:
|
||||||
function $on(target, type, callback, useCapture) {
|
function $on(target, type, callback, useCapture) {
|
||||||
target.addEventListener(type, callback, !!useCapture)
|
target.addEventListener(type, callback, !!useCapture)
|
||||||
@ -62,16 +56,6 @@ function remove(array, thing) {
|
|||||||
array.splice(index, 1)
|
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:
|
// Allow for looping on nodes by chaining:
|
||||||
// qsa('.foo').forEach(function () {})
|
// qsa('.foo').forEach(function () {})
|
||||||
NodeList.prototype.forEach = Array.prototype.forEach
|
NodeList.prototype.forEach = Array.prototype.forEach
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user