Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test("decorate a property with two decorators", function() {
let updatedByAutorun
class Obj {
x = null
}
decorate(Obj, {
x: [serializable(primitive()), observable]
})
const obj = deserialize(Obj, {
x: 0
})
const d = autorun(() => {
updatedByAutorun = obj.x
})
expect(isObservableProp(obj, "x")).toBe(true)
expect(updatedByAutorun).toEqual(0)
obj.x++
expect(obj.x).toEqual(1)
expect(updatedByAutorun).toEqual(1)
expect(serialize(obj).x).toEqual(1)
load () {
const rawProfileList = localStorage.getItem('profileList');
if (rawProfileList) {
try {
const jsProfileList = JSON.parse(rawProfileList);
const profileList = [];
for (const jsProfile of jsProfileList) {
const profile = deserialize(Profile, jsProfile);
profileList.push(profile);
this.profiles.addProfile(profile);
}
} catch (e) {
console.error('Unable to parse localStorage data: ' + e);
}
}
}
deserialize(json, callback) {
return deserialize(getDefaultModelSchema(this), json, callback);
},
};
deserialize: function deserialize$$1(json, callback) {
return deserialize(getDefaultModelSchema(this), json, callback);
}
};
public static instance() {
return deserialize(RouteViewModel, parseQuery())
}