beyond-rails 0.0.205 → 0.0.206

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f84184cdf5a61c85e88fe53777de533a82fb8fb12d4c692bab16030947fa10ce
4
- data.tar.gz: b4ca0e7e8f38d2ad7cc7397ec53a8e762dd5efbebd9083c8e9ab05b88a3692fc
3
+ metadata.gz: 33ea08dc8bf98acf8465442ae93d6ed62dc980c078bbe5bf80feb75113ba0154
4
+ data.tar.gz: f75502fb24fba0b328661979431a0141a58b505fad9e4e640e6b1bc3167f9c89
5
5
  SHA512:
6
- metadata.gz: 347a98b761bb5ae247cedb09105381edade5beac81ae3845b7cef02570aaf3034871a37877248e5cf276870b10c8d362022967a10c90509c41f382fc0e3a4f6f
7
- data.tar.gz: f7563a13190a39ddd6a63dafceef653096eef974900d50ba832a08834126f724802fe4206dd93aa61c874a007d45a2251905b0e786438b519e1f75ff95c5fb62
6
+ metadata.gz: 0d460950281c2df848623313dcaa112e12bf043f587f6dead55463e067a972b9caba3bb86c2e82527ee28c6e43436d6db5003e9fe6c91d85c8c2c654c2a9dca7
7
+ data.tar.gz: b5c04888cd17d6ccc9ff02e06bc087f62c0cfcd5d746df450de6483cf0d502641788d1a6b45125e95d452d04735b00417325a39ac0dc75e000307a02e570e08d
@@ -14,6 +14,7 @@ export default class TimeInput {
14
14
  this.options = options
15
15
  this.tz = options.tz || DEFAULT_TIMEZONE
16
16
  this.timePattern = options.timePattern || 'HH:mm'
17
+ this._skipDomChecking = true
17
18
 
18
19
  this.init()
19
20
  }
@@ -1,11 +1,20 @@
1
1
  import { isFunction } from '../utils'
2
+ import isUndef from '../utils/isUndef'
2
3
  import createdComponents from '../consts/createdComponents'
3
4
 
5
+ const domMap = new Map()
6
+
4
7
  export default function supportDom(target) {
5
8
 
6
9
  return class extends target {
7
10
 
8
11
  init() {
12
+ if (domMap.has(this.dom) && isUndef(this._skipDomChecking)) {
13
+ console.warn('This dom has already been initialized.', this.dom)
14
+ return
15
+ }
16
+ this.setDomToMap()
17
+
9
18
  this._listeners = []
10
19
  this._externalListeners = []
11
20
  if (isFunction(super.init)) {
@@ -14,6 +23,20 @@ export default function supportDom(target) {
14
23
  createdComponents.push(this)
15
24
  }
16
25
 
26
+ setDomToMap() {
27
+ const { dom } = this
28
+ if (dom) {
29
+ domMap.set(dom, true)
30
+ }
31
+ }
32
+
33
+ deleteDomFromMap() {
34
+ const { dom } = this
35
+ if (dom) {
36
+ domMap.delete(dom)
37
+ }
38
+ }
39
+
17
40
  on(name, func) {
18
41
  this._externalListeners.push({ name, func })
19
42
  }
@@ -36,6 +59,7 @@ export default function supportDom(target) {
36
59
  }
37
60
 
38
61
  destroy() {
62
+ this.deleteDomFromMap()
39
63
  this._externalListeners.length = 0
40
64
  this.removeEvents()
41
65
  if (isFunction(super.destroy)) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beyond-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.205
4
+ version: 0.0.206
5
5
  platform: ruby
6
6
  authors:
7
7
  - kmsheng