npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

muvjs

v2.3.5

Published

MUV architecture in pure javascript

Downloads

19

Readme

muvjs

MUV architecture in modular javascript

Background

MUV (Model Update View), otherwise known as MVC (Model View Component), is found in many applications' core software architecture using a one way state change. The idea revolves around state immutability and functional programming. For example, a View listens for user events that fire an action through a dispatch which is handled by an update function that returns a new model which gets re-rendered in the view

Note: MuvJS's architecture is heavily inspired in ELM, and React+Redux format. I encourage you to learn both.

Since v2.0, there are two new concepts added: Ignition and Subscriptions. Therefore this can technically be called MUVisJS. An Ignition is just a simple call to a dispatch that will initialize anything necessary; used for signing the user in, or reading at cookies, etc. Basically things that do not require user input but are required at startup. And Subscriptions are all asynchronous operation that are not required to be within the internal loop of MUV; used to call servers and the likes. Think of it like what is Saga to Redux+Saga.

Ignitions are called only once, while subscriptions are called by the update function (or in other words, after actions are dispatched and handled. For they eventually are effects of actions).

Installation

npm i muvjs

Usage

  1. Construct your modular app App.mjs with the following syntax

       
    // initialize your model
       
    export const model = {
      ...
    }
       
    //handle actions, change model accordingly, and create new effects
       
    export const update = model => action => {
      ...
      return {model, effects};
    };
       
    // display app according to the model, and dispatch any actions
       
    export const view = dispatch => model => {
      ...
    }
       
       

    importing components from muv-dom.mjs, and exporting the initial model model, the update function update and the view function view

    Since v2.0, now you can add the following:

     // dispatch any initializing action
    
     export const ignition = dispatch => {
       ...
     }
    
     // handle effects, and dispatch any actions
    
     export const subscriptions = dispatch => {
       ...
     }
    
        

    exporting the subscriptions subscriptions, and the ignition function ignition

  2. Create your muv modular initializer index.mjs

    import {muv} from 'muvjs/muv.mjs';
    import {model, update, view, ignition, subscriptions} from './App'
       
    muv({model, update, view, ignition, subscriptions})('root');
  3. create the root div, and include your muv modular initializer in your index.html

    <div id="root"></div>
    <script type="module" src="index.mjs"></script>

Then you can edit your App.js to your needs

Have fun!

Example

View full examples at https://github.com/yoyomo/muvjs-example

Create MuvJS App

You can now use a brew command to create a MuvJS app from scratch: https://github.com/yoyomo/create-muvjs-app