wip: do not use public class fields yet

Browser support is not enough.
This commit is contained in:
Yohan Boniface 2024-04-29 17:59:33 +02:00
parent f10d345113
commit 6bdba1d0ed

View file

@ -3,7 +3,6 @@ import * as Utils from './utils.js'
import { translate } from './i18n.js' import { translate } from './i18n.js'
class Rule { class Rule {
_condition = null
get condition() { get condition() {
return this._condition return this._condition
@ -14,7 +13,6 @@ class Rule {
this.parse() this.parse()
} }
_isDirty = false
get isDirty() { get isDirty() {
return this._isDirty return this._isDirty
@ -26,6 +24,18 @@ class Rule {
} }
constructor(map, condition = '', options = {}) { constructor(map, condition = '', options = {}) {
// TODO make this public properties when browser coverage is ok
// cf https://caniuse.com/?search=public%20class%20field
this._condition = null
this._isDirty = false
this.OPERATORS = [
['>', this.gt],
['<', this.lt],
// When sent by Django
['&lt;', this.lt],
['!=', this.not_equal],
['=', this.equal],
]
this.map = map this.map = map
this.active = true this.active = true
this.options = options this.options = options
@ -52,15 +62,6 @@ class Rule {
return other < this.expected return other < this.expected
} }
OPERATORS = [
['>', this.gt],
['<', this.lt],
// When sent by Django
['&lt;', this.lt],
['!=', this.not_equal],
['=', this.equal],
]
parse() { parse() {
let vars = [] let vars = []
this.cast = (v) => v this.cast = (v) => v