1.0.5 • Published 1 year ago

trackable-object v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

npm version example workflow

Trackable Object (Up your object limits 🐢)

banner500x500

Track object deeply 🔍 so you can check if it changed or any of it's nested properties had changed.

Installation

CDN

<script src="https://cdn.jsdelivr.net/npm/trackable-object@latest/build/trackable-object.js"></script>

NPM

npm i trackable-object

How it works?

<script src="https://cdn.jsdelivr.net/npm/trackable-object@latest/build/trackable-object.js"></script>

<script>

const parentTO = TrackableObject.create({
    name:'parent_name'
});

parentTO.name = 'parent_name_updated';

console.log(trackableObject.t_changes()); //  Output: {name : 'parent_name_updated'}

console.log(JSON.stringify(person)); // and you can serialize your object as well 

</script>

Use Cases:

  • Check if the property changed before sending another request so will save the APIs cost.
  • Warning the client before leaving regarding he can loss his changes.

Notes:

  • If your object property get back to the old value then will not be exists in the t_changes() output.

API

NameDescriptionType
t_changesGet all the changed propertiesfunction():Map<string,string>
1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.1-b

1 year ago

1.0.0

1 year ago