Api / JavaScript /

register( object )

Make a object observable that can be listen for mutations.

Arguments

object Object

An object or a class instance.

Returns

A ES6 proxy object ready to be observed.

Examples

const user = dop.register({name: 'John'})
user.name // 'John'
const user = dop.register({name: 'John'})
const user2 = dop.register(user)
user === user2 // true
const user = dop.register({name: 'John'})
const user2 = dop.register({name: 'John'})
user === user2 // false
const userObject = {name: 'John'}
const user = dop.register(userObject)
user === userObject // false

See also