Remove computed values.
Object
A registered object.
String
Property of the object.
Function
optionalFunction of the computed value to remove. This argument is optional, not passing function removeComputed will remove all computed values would have.
An array with the functions of the removed computed values.
const user = dop.register({
name: 'John',
surname: 'Doe',
fullname: dop.computed(function() {
return `${this.name} ${this.surname}`
})
})
console.log(user.fullname) // 'John Doe'
user.name = 'Enzo'
console.log(user.fullname) // 'Enzo Doe'
dop.removeComputed(user, 'fullname')
user.name = 'Josema'
console.log(user.fullname) // 'Enzo Doe'
See also