1.0.0 • Published 6 years ago

moria v1.0.0

Weekly downloads
12
License
MIT
Repository
github
Last release
6 years ago

Moria v2

A Router component for Mithril in the vein of react-router, using universal-router & history. Designed for the browser. Light & assumptuous.

Go on?

Download, run npm start, then open the URL displayed in the CLI and navigate to demo.html to see a basic example.

Yeah but

Exports an object like this:

const {Router, Link, history} = require('mithril-router')

Hang on

// Nestable route definitions!
m(Router, {
    '/paths' : () => 'Map to views!',
    '/:404?' : () => 
        'https://github.com/pillarjs/path-to-regexp',
    '/how'   : () => [
        'https://www.kriasoft.com/universal-router/',
        // ^ simplified and extended
        'https://github.com/ReactTraining/history#usage',
    ],
    '/they'  : ({ // are given cool stuff:
            key, path, params, action,
        }) => '',

    then: sameAsAbove => {},
    catch: sameAsAbove => {}, 
    finally: sameAsAbove => {}, 
})

// Links!
m(Link, 
    m('a[href=/adsfhtyu]', 'LOL!')
)

// The constructed history object!
history.goBack()
history.replace('/_srtryq345tgv')
2.0.0-alpha.1

6 years ago

1.0.0

6 years ago

0.0.12

10 years ago

0.0.9

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago