View HotComponent.js
const= new Map()
const queue = new Set()
let scheduled = false
function schedule(){
if(scheduled) return
scheduled = true
View m.sideEffects.js
export default function mSideEffects(lifecycle){
m.mount(document.createDocumentFragment(), Object.assign({
view : () => ''
},
lifecycle
))
}
View ancestors.js
export default function * ancestors({parentNode}){
if(parentNode){
yield parentNode
yield * ancestors(parentNode)
}
}
View vTreeWalker.js
export default function * vTreeWalker(vnode){
yield vnode
if(vnode.instance)
yield * vTreeWalker(vnode.instance)
else if(Array.isArray(vnode.children))
for(const child in vnode.children)
yield * vTreeWalker(child)
}
View Drag.js
import m from 'mithril'
import {stream} from 'flyd'
import PointerStream from 'pointer-stream'
// The component state object is provided wholesale for the author API, therefore we store our internal API state in a Map
const= new Map()
// Bind a temporal vnode to the private store associated with its persistent state
// This allows us to reliably access the last render's dom and attribute data
function update(vnode){
View mithril-displacer.js
const patch = (dom, now, then) => {
const host = document.createDocumentFragment()
const {domSize} = then
host.vnodes = then
for(
let i = 0, node = then.dom;
i < domSize;
i++, node = node.nextSibling
View matchHeights.js
const div = document.createElement('div')
const div_w0 = div.cloneNode()
const div_w100 = div.cloneNode()
const div_flex = div.cloneNode()
div_w0.style.marginRight = '-100%'
div_w0.style.visibility = 'hidden'
div_w0.style.width = '100%'
div_w0.setAttribute('aria-hidden', true)
View multiMap.js
function multiMap( keys ){
const lists = {}
keys.forEach( key => lists[ key ] = [] )
return {
set( entry ){
let index = lists[ keys[ 0 ] ].indexOf( entry[ keys[ 0 ] ] )
if( index < 0 ) index = lists[ key[ 0 ] ].length
View on.js
const supports = {
capture : false,
passive : false,
once : false
}
try {
document.addEventListener( 'test', null, {
get capture(){ supports.capture = true },
get passive(){ supports.passive = true },
View isomorphic-code-splitting-webpack-2-mithril-route-resolver.js
import m from 'mithril'
import store from '../../store'
import {loadUsers} from '../../data/users/actions'
import layout from '../../components/layout'
if (typeof require.ensure !== 'function') require.ensure = (d, c) => c(require)
async function getJs(){
return (await require('./users.js')).default
}