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

mk-app-loader

v2.0.3

Published

mk-app-loader

Downloads

47

Readme

mk-app-loader

mk简介

mk = monkey king = 齐天大圣

mk-app-loader特点

  • 这是一个基于react, redux, immutable的开源项目
  • 简化原生redux实现状态管理的过程
  • 以app的方式组织代码,隔离app状态
  • 单页程序,通过提供不同app名装载不同应用
  • 每个app模式统一,可维护性强,大规模开发,项目管理更加容易

适用人员

有react, redux经验的人员

运行example

$ cd example
$ npm install
$ npm start
浏览器访问127.0.0.1:8089

API

npm install mk-app-loader --save

属性 | 说明 | 类型 -----|-----|----- AppLoader | app名 | ReactNode config| 配置,{apps:"多个应用对象",middlewares:"redux中间件数组",actionInjections:'action注入',reducerInjections:'reducer注入',targetDomId:'render目标dom', startAppName:'入口app名'} | function start| 启动 | function

AppLoader组件属性

属性 | 说明 | 类型 -----|-----|----- name | app名 | string

this.props包含属性介绍

属性 | 说明 | 数据类型 -----|-----|----- action文件中export的所有方法 | component可以通过this.props.action方法名(),调用action文件中export的所有方法 | function payload | 当前应用的状态 | immutable Map appName | 当前app名,如helloWorld | string appFullName | 当前app全名包括query,如:helloWorld?a=1 | string appQuery | 当前app全名中'?'后字符串,如:a=1 | string appParams | appQuery转object,如:{a:1} | object

action代码

定义component事件需要处理的一些行为方法,示例代码如下

export function initView(){
	//injectFuns是appMiddleware注入对象,其中最重要的一个reduce方法可以指定reducer方法名就可以调用
	//避免redux中处理消息的很多代码
	return injectFuns=>{
		injectFuns.reduce('initView')
	}
}
  • injectFuns是appMiddleware注入的,默认包含下面两个方法

属性 | 说明 | 数据类型 -----|-----|----- reduce | reduce方法能调用reducer的方法,格式:reduce(reducer中方法名, 参数1, 参数2...)|function getState | getState方法能取到当前应用的state | function

reducer代码

定义修改状态的方法,由action调用

它里面所有对外的方法第一个参数是state表示旧状态,返回值是新状态

示例代码如下

import {Map} from 'immutable'

export function initView(state=Map() ){
	return state.set('text', '这是hello world app!')
}