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

dynamic-object

v2.2.1

Published

<a href="https://travis-ci.org/ascoders/dynamic-object"><img src="https://img.shields.io/travis/ascoders/dynamic-object/master.svg?style=flat" alt="Build Status"></a>

Downloads

43

Readme

dynamic-object

dynamic-object 利用 proxy 完整实现了 object.observer。主要为 react 提供数据流功能。可以结合 dynamic-react 以 mutable 方式为 react 组织数据流;同时也支持融合 redux,结合 mutable 与 immutable 的优势,以 mutable 方式组织 store,以 immutable 方式更新数据。

功能与 mobx 很像,同时借鉴了 nx-js 实现理念。给力的地方在于,不支持 ie11 浏览器!非常激进,核心使用 proxy,抛弃兼容性换来的是超高的性能,以及完美的动态绑定。

核心用例:

import { observable, observe } from "dynamic-object"

const dynamicObj = observable({
    a: 1
})

observe(() => {
    console.log("dynamicObj.a has changed to", dynamicObj.a) 
})
// output: dynamicObj.a has changed to 1

dynamicObj.a = 2
// output: `dynamicObj.a has changed to 2`

在线 Demo

安装

yarn add dynamic-object --save

稳定性

目前通过了 100%(50个)测试用例

功能

结合 dynamic-react

以 mutable 方式管理数据流,vm 层使用 dynamic-react,只有使用到的变量发生变动,才会触发更新!

查看 在线 Demo,支持分型的 分型 Demo

Api

observableobserve: 产生对象的代理、动态跟踪代理对象变化;dynamic-react: 将代理对象结合到 react 当中,自动、精确的更新组件;Action: 建议所有修改收敛在 action 中,且支持更新合并。

结合 dependency-inject

以依赖注入的方式管理 store 与 action,直接查看 在线 Demo,快速结合 分型 demo

结合 react-redux

支持以 mutable 方式管理数据流,但 vm 层对接到 redux,虽然以可变方式修改数据,但会自动生成不可变数据!在线 Demo

也可以 fork 本项目,npm start 就可以打开 redux todoMVC!数据层依然是 mutable。

unpkg

https://unpkg.com/[email protected]/built/bundle.js

实现原理解析