GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sdt-javascript/mithril at master · procore/sdt-javascript

Expand file tree

/

mithril

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

mithril

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
README.md
README.md
 
 

README.md

Outline

Unearth Mithril.js guide

A mostly reasonable approach to Mithril and JSX

Table of Contents

  1. Basic Rules
  2. Models

Basic Rules

  • Split code by view and model.
  • Only one model per file.
  • Multiple components are allowed in a single file. (Don't abuse this)

Models

2.1 General

The model is tied to a view or views. The Model is used to execute logic and hold state for the view it is tied to.

⬆ back to top 2.2 Use classes.

Why? It is easier to refactor the model to support multiple instances if the model is already a class.

    // bad
    const model = {
        init() {
            // do init
        }
    }

    export default model;

    // good
    class Model {
        init() {

        }
    }

    export default new Model();

    // good
    class Model {
        init() {

        }
    }

    export default Model;

⬆ back to top

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.