Make property non-configurable
This commit is contained in:
parent
8de5303550
commit
e9e8aeba4f
1 changed files with 5 additions and 5 deletions
|
@ -15,7 +15,7 @@ const target = Symbol("Proxy Target")
|
||||||
export class SynchronousChangeEvent extends Event {
|
export class SynchronousChangeEvent extends Event {
|
||||||
constructor(change) {
|
constructor(change) {
|
||||||
super('synchronous', {cancelable: true})
|
super('synchronous', {cancelable: true})
|
||||||
this.change = change
|
this.change = Object.freeze(change)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,10 +74,10 @@ export class Observable extends EventTarget {
|
||||||
#ref = new WeakRef(this)
|
#ref = new WeakRef(this)
|
||||||
get ref() { return this.#ref }
|
get ref() { return this.#ref }
|
||||||
|
|
||||||
observable = true
|
constructor({synchronous=false}={}) {
|
||||||
|
|
||||||
constructor({synchronous}={}) {
|
|
||||||
super()
|
super()
|
||||||
|
Object.defineProperty(this, "observable", {value: true, configurable: false, writable: false})
|
||||||
|
|
||||||
if (this.constructor === Observable) {
|
if (this.constructor === Observable) {
|
||||||
throw new TypeError("Cannot instantiate abstract class")
|
throw new TypeError("Cannot instantiate abstract class")
|
||||||
}
|
}
|
||||||
|
@ -367,7 +367,7 @@ export class ObservableElement extends Observable {
|
||||||
constructor(target, {get=undefined, equal=undefined, ...options}={}) {
|
constructor(target, {get=undefined, equal=undefined, ...options}={}) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
super(options)
|
super(options)
|
||||||
this[target] = target
|
Object.defineProperty(this, "target", {value: target, configurable: false, writable: false})
|
||||||
|
|
||||||
this.#getValue = get ?? (target => target.value)
|
this.#getValue = get ?? (target => target.value)
|
||||||
this.#equal = equal ?? ((a, b) => a===b)
|
this.#equal = equal ?? ((a, b) => a===b)
|
||||||
|
|
Loading…
Reference in a new issue