JSFiddle

  • Mithril onbeforeremove

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

    var MainLayout = {
      view: function (vnode) {
        var attrs = vnode.attrs;
        return m('.main', [
          m('nav', 'fake menu ...'),
        	m('h1', {class: 'page-title ...
  • Autoredraw question

    Is it intended that button created outside of MainComponent's view does not participate in autoredraw?

    var Button = {
        controller: function(){
        	this.active = false
        },
        view: function (state,attrs) {
            var onclick = function () {state.active = !state.active}
            return m ...
  • Autoredraw question

    Is it intended that button created outside of MainComponent's view does not participate in autoredraw?

    var logs = []
    
    function log(vnode){
    		logs.push([vnode.attrs.text, {active: vnode.state.active}])
    }
    
    var Button = {
        active: false,
        oninit: log ...
  • Autoredraw question

    Is it intended that button created outside of MainComponent's view does not participate in autoredraw?

    var logs = []
    
    function log(vnode){
    		logs.push([vnode.attrs.text, {active: vnode.state.active}])
    }
    
    var Button = {
        active: false,
        oninit: log ...
  • Autoredraw question

    Is it intended that button created outside of MainComponent's view does not participate in autoredraw?

    var logs = []
    
    function log(vnode){
    		logs.push([vnode.attrs.text, {active: vnode.state.active}])
    }
    
    var Button = {
        active: false,
        oninit: log ...
  • An immediate alert

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

    alert( 'iframe init' )
  • Countdown clock #1 is the latest revision

    Countdown clock with Mithril

    const Clock = function () {
      let minutes = 25
      let seconds = 0
    
      const clock = {
        reset: () => {e
          minutes = 25
          seconds = 0
        },
        getTime: () => {
          return `${twoDigits ...
  • Mithril component- with an bounded controller

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

    //namespace
    dataUrl = "//jsonplaceholder.typicode.com/users";
    var User = function(user){
    	user = user || {}
    	this.name = m.prop(user.name ||'');
    }
    
    User.load ...
  • Mithril component- with an bounded controller

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

    //namespace
    dataUrl = "//jsonplaceholder.typicode.com/users";
    var User = function(user){
    	user = user || {}
    	this.name = m.prop(user.name ||'');
    }
    
    User.load ...
  • Mithril nested components #1 is the latest revision

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

    //namespace
    dataUrl = "//jsonplaceholder.typicode.com/users";
    
    var User = function(user){
    	user = user || {}
    	this.name = m.prop(user.name ||'');
    }
    
    User.load ...