It's what you already love, only better.
Do you Mei-O?
Meiosis is a library and an architecture pattern for dividing a web application into small, independent, manageable, and testable parts, while letting you keep using the tools that you already love. Meiosis manages the data flow and lets you choose whatever you like for rendering views.
Meiosis implements the SAM pattern by Jean-Jacques Dubray.
Developing a web application with Meiosis involves three simple concepts:
statefunction that takes the model and computes additional properties to produce the complete application state.
- Write the view as a function of the model/application state.
- Have a way to propose changes to the model. After the changes have been accepted, Meiosis re-renders the view by calling the view function with the new model/application state.
Meiosis is a small, simple library with no dependencies. It helps you build components with minimal effort, providing an architecture to structure your code that scales well as your application gets larger and more complex.
You choose what you like to use for creating views. Meiosis organizes how the data flows in your application by:
- Creating and maintaining a single root model, and (optionally) calling your
statefunction to produce the application state.
- Letting you hook in functions that receive proposals and change the model accordingly
- Passing action objects to your views so that they can trigger proposals
- Automatically re-rendering your views
- Letting you define logic for actions that should automatically trigger.
Meiosis is about managing the application data flow. Create components by specifying functions, and Meiosis takes care of the wiring. Every part of the process is optional, so you can specify what you need for each component.
For documentation please refer to the Meiosis Guide.
Try out the examples online: http://meiosis.js.org/example-index.html
Example code: https://github.com/foxdonut/meiosis-examples
Please post questions and suggestions as Github issues on the meiosis repository.
You can also chat on the Gitter channel.
Why the name Meiosis?
I picked the name Meiosis for three reasons:
- it's a biology term for a type of cell division; this is an analogy to the idea of dividing your application into smaller pieces;
- it's a figure of speech that intentionally understates something or implies that it is lesser in significance or size than it really is, meaning that this library is meant to be small, humble, and not replace what people use, just improve upon it; and
Meiosis is developed by foxdonut (@foxdonut00) and is released under the MIT license.