You can set the prototype of the deserialized object to your class to "re-attach" your functions. e.g.:
function someClass(i)
{
this.someInt = i || 0;
this.addOne = function()
{
this.someInt++;
console.log(this.someInt);
};
}
var fromClass = new someClass();
var fromDB = {...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.