JSFiddle

  • Streams aren't coerced in situations where strings are expected

    No-Library (pure JS), HTML, CSS, JavaScript

    const value = m.prop( 'Hello' )
    
    m.render(
    	document.body,
    	m( 'input', { value } )
    )
  • Will DOM value property assignment invoke toString?

    No-Library (pure JS), HTML, CSS, JavaScript

    const value = m.prop( 'Hello' )
    
    value.toString = () => value()
    
    m.render(
    	document.body,
    	m( 'input', { value } )
    )
  • Animations in singleton pattern. Any bugs? #6 is the latest revision

    As described here: https://gist.github.com/barneycarroll/601ba9372257644689b48098b33a65ad

    const Header = {
    	singleton : singleton(),
    
      style : j2c.sheet( {
        '.h1' : {
          color : 'red',
          animation : {
          	name : 'fadeIn',
            duration : '1s'
          }
        },
        '@keyframes fadeIn' : {
        	from : { opacity : 0 ...
  • Mithril 1 singleton components

    No-Library (pure JS), HTML, CSS, JavaScript

    setTimeout( () => {
    
    const Header = {
    	singleton : makeSingleton(),
    
      style : j2c.sheet( {
        '.h1' : {
          color : 'red'
        }
      } ),
    
      view : () =>
      	m( 'Header',
          m( Header.singleton, m( 'style', Header ...
  • Mithril 0.2 singleton components

    As described here: https://gist.github.com/barneycarroll/601ba9372257644689b48098b33a65ad

    const Header = {
    	singleton : singleton(),
    
      style : j2c.sheet( {
        '.h1' : {
          color : 'red'
        }
      } ),
    
      view : () =>
      	m( 'Header',
          m( Header.singleton, 
            m( 'style', Header.style ...
  • Mithril 1 singleton components

    Blocked by https://github.com/lhorie/mithril.js/issues/1146

    /* uniqueOutlet usage code */ setTimeout( () => {
    const Header = {
    	outlet : singletonFactory(),
    
      style : j2c.sheet( {
        '.h1' : {
          color : 'red'
        }
      } ),
    
      view : () => [
        m( Paragraph.outlet, 
          m( 'style ...
  • Implicit redraw only affects the last mountpoint

    No-Library (pure JS), HTML, CSS, JavaScript

    const Clock  = {
    	view : function( component ){
      	return [
          m( 'h1', 'Clock' ),
            
          m( 'p', 
            'The time is: ', 
            Date.now() ),
    
          m( 'p', 
            'This component ...
  • Mithril (<1) view output

    No-Library (pure JS), HTML, CSS, Babel

    setTimeout( () =>
    m.mount( app, {
      view : ctrl => {
        if( ctrl.state )
          ctrl = ctrl.state
        
        const output = (
          m( '#app',
            m( 'h1', 'The meaning ...
  • Mithril (>=1) view output

    No-Library (pure JS), HTML, CSS, Babel

    setTimeout( () =>
    m.mount( app, {
      view : ctrl => {
        if( ctrl.state )
          ctrl = ctrl.state
        
        const output = (
          m( '#app',
            m( 'h1', 'The meaning ...
  • Convert DOM into Mithril virtual DOM

    Including a reducer!

    m.mount( placeholder, {
      controller : function(){
        this.repetitions = 1
      },
      
      view : ctrl => [
        m( 'label', 
          'Get Mithril to reproduce prerendered content ',
          m( 'input ...