README
A lightweight (<1kb
) compiler-augmented Virtual DOM. It's fast!
What is Million?
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?
- 🦁 Built for libraries that compile
- 📦 Lightweight bundle size (<1kb brotli+min)
- ⚡ Fast runtime operations
- 🛠️ Composable using drivers, sensible by default
Installing Million
Inside your project directory, run the following command:
npm install million
Quick Start
Below is an extremely simple implementation of a Counter page using Million.
import { m, render } from 'million';
let seconds = 0;
setInterval(() => {
render(document.body, m('p', undefined, [`Time elapsed: ${seconds}`]));
seconds++;
}, 1000);
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.
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 interested in an alternative library to use.
Why is it called "Million"? The name originated with the goal of being able to handle 1M+ ops/sec for benchmarks.
What is the logo? The logo stems from the suffix of Million, and is a graphic of the nose and mouth of a lion.
Sponsors
Want your logo here? → Sponsor Million
License
Million is MIT-licensed open-source software and research by Aiden Bai.