mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
wip: use getter/setter for Rule dynamic properties
This commit is contained in:
parent
7367de5545
commit
05ea45acd2
1 changed files with 22 additions and 22 deletions
|
@ -3,32 +3,32 @@ import * as Utils from './utils.js'
|
||||||
import { translate } from './i18n.js'
|
import { translate } from './i18n.js'
|
||||||
|
|
||||||
class Rule {
|
class Rule {
|
||||||
|
#condition = null
|
||||||
|
|
||||||
|
get condition() {
|
||||||
|
return this.#condition
|
||||||
|
}
|
||||||
|
|
||||||
|
set condition(value) {
|
||||||
|
this.#condition = value
|
||||||
|
this.parse()
|
||||||
|
}
|
||||||
|
|
||||||
|
#isDirty = false
|
||||||
|
|
||||||
|
get isDirty() {
|
||||||
|
return this.#isDirty
|
||||||
|
}
|
||||||
|
|
||||||
|
set isDirty(status) {
|
||||||
|
this.#isDirty = status
|
||||||
|
if (status) this.map.isDirty = status
|
||||||
|
}
|
||||||
|
|
||||||
constructor(map, condition = '', options = {}) {
|
constructor(map, condition = '', options = {}) {
|
||||||
this.map = map
|
this.map = map
|
||||||
this.active = true
|
this.active = true
|
||||||
this.options = options
|
this.options = options
|
||||||
let isDirty = false
|
|
||||||
Object.defineProperty(this, 'isDirty', {
|
|
||||||
get: () => {
|
|
||||||
return isDirty
|
|
||||||
},
|
|
||||||
set: (status) => {
|
|
||||||
isDirty = status
|
|
||||||
if (status) {
|
|
||||||
this.map.isDirty = status
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
let _condition
|
|
||||||
Object.defineProperty(this, 'condition', {
|
|
||||||
get: () => {
|
|
||||||
return _condition
|
|
||||||
},
|
|
||||||
set: (value) => {
|
|
||||||
_condition = value
|
|
||||||
this.parse()
|
|
||||||
},
|
|
||||||
})
|
|
||||||
this.condition = condition
|
this.condition = condition
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue