GithubHelp home page GithubHelp logo

stieneee / object-observable-lite Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 1.14 MB

Observe object changes deeply without cloning in the most efficient manner.

License: MIT License

JavaScript 100.00%
observable changes on-change object-tracking

object-observable-lite's Introduction

object-observable-lite

Observe object changes deeply without cloning in an efficient manner.

Goals

The package must observe deeply. The package must not clone the nested objects. The package must handle all types. The package should attempt to minimize overhead

Caveats

Returned changes are not cloned. Instances and therefore will mutate as the observed object mutates

object-observable

This is a derivative of object-observable with many of the features striped for improved performance.

Package Comparison

Several similar packages were tested which resulted in this package being created. The comparison of these packages can be seen here.

Package Comparison

Usage

const objectObservableLite = require('object-observable-lite');

const obj = testObj = {
  x: 1,
  foo: {
    y: 1,
  },
  bar: ['a', { b: 'b' }],
  today: new Date(),
};

const watchedObject = objectObservableLite(obj, (change) => {
  console.log(change)
});

watchedObject.x = 2;

Opportunities for Improvements

The comparison of other packages suggests there is still room for improvement in the overall efficiency of this package.

Other packages will have to be more deeply analyzed to determine how this package could be improved.

Contributing

Pull request are welcome.

object-observable-lite's People

Contributors

dependabot[bot] avatar stieneee avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

object-observable-lite's Issues

Array length

When push() and pop() values of array, the change() function returns the same old and value for the array length

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.