constructor()

in packages/core/src/rendering/style-map.ts [118:154]


  constructor() {
    super()

    // 阻止这些属性被 Object.keys 枚举
    Object.defineProperties(this, {
      '_events': {
        enumerable: false,
        configurable: true,
      },
      '_eventsCount': {
        enumerable: false,
        configurable: true,
      }
    })

    return new Proxy(this, {
      set(
        target: any,
        styleName: string,
        styleValue: any,
      ) {
        if (target[styleName] !== styleValue) {
          (<any>target)[styleName] = styleValue
          target.emit(styleName, styleValue)
        }
        return true
      },
      deleteProperty(
        target: any,
        styleName: string,
      ) {
        delete target[styleName]
        target.emit(styleName, undefined)
        return true
      },
    })
  }