Skip to content

BanKnight/savable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

savable

a tool to detect if an object is changed,it can used for smoothly data saving.

install

npm install savable --save

how to use

let wrap = savable({ test: 1 }, function ()
{
    console.log("obj changed")
})

wrap.test = 2
wrap.obj = {}

console.dir(wrap)       //{ test: 2, obj: {} }
console.log(wrap.__changed)     //true

wrap.__changed = false

console.log(wrap.__changed) //false

wrap.obj.ceshi = "what"
console.log(wrap.__changed) //true

wrap.__changed = false

console.log(wrap.__changed) //false

delete wrap.obj

console.dir(wrap)           //{ test: 2 }
console.log(wrap.__changed) //true

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published