What is Million?
Million is a lightweight (<1kb
) compiler-augmented Virtual DOM. It's fast!
Current Virtual DOM implementations are inadequateβRanging from overcomplicated to abandoned, most are unusable without sacrificing raw performance and size.
Million aims to fix this, providing a library-agnostic Virtual DOM to serve as the core for Javascript libraries that focus on precompilation and static analysis.
π Learn Million in 10 minutes! β
Why Million?
Advantages |
Use Cases |
|
Installing Million
Inside your project directory, run the following command:
npm install million
Quick Start
Here is an extremely simple implementation of a Hello World page using Million.
import { _, m, render } from 'million';
render(document.body, m('h1', _, ['Hello World!']));
// <h1>Hello World</h1> rendered to <body>
render()
function has a standard interface that is used in many Virtual DOM libraries. First argument is a DOM node that will be used as the parent DOM reference, and the second one is a Virtual DOM to render.
m()
function will instantiate a "Virtual DOM" node for an element.
_
is a shorthand for the undefined
value.
Resources & Contributing Back
Looking for the docs? Check the documentation out.
Want to talk to the community? Hop in our Discord and share your ideas and what you've build with Million.
Have a question about Million? Post it on the Discord or GitHub Discussions and ask the community for help.
Find a bug? Head over to our issue tracker and we'll do our best to help. We love pull requests, too!
We expect all Million contributors to abide by the terms of our Code of Conduct.
β Start contributing on GitHub (pnpm welcome
)
Acknowledgments
Million takes heavy inspiration from snabbdom, ivi, mikado, and more. Feel free to check them out if you're interested in an alternative library to use.
Million is being used in open source work like tinypages, hacky, and more.
Sponsors
Want your logo here? β Sponsor Million
License
Million is MIT-licensed open-source software and research project by Aiden Bai.