add-to-calendar-button 2.6.2 → 2.6.4

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.
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: 3D
7
7
  *
8
- * Version: 2.6.2
8
+ * Version: 2.6.4
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Date
7
7
  *
8
- * Version: 2.6.2
8
+ * Version: 2.6.4
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Flat
7
7
  *
8
- * Version: 2.6.2
8
+ * Version: 2.6.4
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Neumorphism
7
7
  *
8
- * Version: 2.6.2
8
+ * Version: 2.6.4
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Round
7
7
  *
8
- * Version: 2.6.2
8
+ * Version: 2.6.4
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Text
7
7
  *
8
- * Version: 2.6.2
8
+ * Version: 2.6.4
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Default
7
7
  *
8
- * Version: 2.6.2
8
+ * Version: 2.6.4
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -974,14 +974,14 @@ function tzlib_get_timezones(jsonType = false) {
974
974
  * Add to Calendar Button
975
975
  * ++++++++++++++++++++++
976
976
  *
977
- * Version: 2.6.2
977
+ * Version: 2.6.4
978
978
  * Creator: Jens Kuerschner (https://jekuer.com)
979
979
  * Project: https://github.com/add2cal/add-to-calendar-button
980
980
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
981
981
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
982
982
  *
983
983
  */
984
- const atcbVersion = '2.6.2';
984
+ const atcbVersion = '2.6.4';
985
985
  const atcbCssTemplate = {};
986
986
  const atcbIsBrowser = () => {
987
987
  if (typeof window === 'undefined') {
@@ -4960,12 +4960,20 @@ if (atcbIsBrowser()) {
4960
4960
  elem.innerHTML = template;
4961
4961
  this.attachShadow({ mode: 'open', delegateFocus: true });
4962
4962
  this.shadowRoot.append(elem.content.cloneNode(true));
4963
- this.loaded = false;
4964
- this.initialized = false;
4963
+ this.state = {
4964
+ initializing: false,
4965
+ initialized: false,
4966
+ ready: false,
4967
+ updatePending: false,
4968
+ };
4965
4969
  this.data = {};
4966
4970
  this.error = false;
4967
4971
  }
4968
4972
  async connectedCallback() {
4973
+ if (this.state.initializing || this.state.ready) {
4974
+ return;
4975
+ }
4976
+ this.state.initializing = true;
4969
4977
  const debugVal = this.getAttribute('debug');
4970
4978
  this.debug = this.hasAttribute('debug') && (!debugVal || debugVal === 'true' || debugVal === '') ? true : false;
4971
4979
  if ((this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') || (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '')) {
@@ -4986,19 +4994,23 @@ if (atcbIsBrowser()) {
4986
4994
  console.error(e);
4987
4995
  atcb_render_debug_msg(this.shadowRoot, e);
4988
4996
  }
4989
- this.loaded = true;
4997
+ this.state.initializing = false;
4998
+ this.state.ready = true;
4990
4999
  return;
4991
5000
  }
4992
5001
  }
4993
- this.loaded = true;
4994
5002
  await this.initButton();
5003
+ this.state.initializing = false;
5004
+ this.state.initialized = true;
5005
+ this.state.ready = true;
5006
+ return;
4995
5007
  }
4996
5008
  disconnectedCallback() {
4997
- atcb_cleanup(this.shadowRoot, this.data);
5009
+ atcb_cleanup(this.shadowRoot, this.identifier);
4998
5010
  if (this.debug) {
4999
- console.log('Add to Calendar Button "' + this.data.identifier + '" destroyed');
5011
+ console.log('Add to Calendar Button "' + this.identifier + '" destroyed');
5000
5012
  }
5001
- if (document.querySelectorAll('add-to-calendar-button').length == 0) {
5013
+ if (document.querySelectorAll('add-to-calendar-button').length === 0) {
5002
5014
  atcbBtnCount = 0;
5003
5015
  }
5004
5016
  }
@@ -5017,14 +5029,20 @@ if (atcbIsBrowser()) {
5017
5029
  })
5018
5030
  .concat(observeAdditionally);
5019
5031
  }
5020
- async attributeChangedCallback(name, oldValue, newValue) {
5021
- if (!this.loaded) {
5032
+ attributeChangedCallback(name, oldValue, newValue) {
5033
+ if (this.state.initializing || !this.state.ready) {
5022
5034
  return;
5023
5035
  }
5024
- if (this.debug && this.initialized) {
5036
+ if (this.debug && this.state.initialized) {
5025
5037
  console.log(`${name}'s value has been changed from ${oldValue} to ${newValue}`);
5026
5038
  }
5027
- atcb_cleanup(this.shadowRoot, this.data);
5039
+ if (!this.updatePending) {
5040
+ this.updatePending = true;
5041
+ setTimeout(() => this.updateComponent(), 0);
5042
+ }
5043
+ }
5044
+ async updateComponent() {
5045
+ if (!this.updatePending) return;
5028
5046
  this.data = {};
5029
5047
  this.shadowRoot.querySelector('.atcb-initialized').remove();
5030
5048
  const elem = document.createElement('template');
@@ -5034,7 +5052,7 @@ if (atcbIsBrowser()) {
5034
5052
  this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
5035
5053
  if (this.data.proKey) this.proKey = this.data.proKey;
5036
5054
  } else if (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '') {
5037
- this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
5055
+ this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
5038
5056
  if (this.data.proKey) this.proKey = this.data.proKey;
5039
5057
  }
5040
5058
  if (!this.data.name || this.data.name === '') {
@@ -5045,20 +5063,22 @@ if (atcbIsBrowser()) {
5045
5063
  console.error(e);
5046
5064
  atcb_render_debug_msg(this.shadowRoot, e);
5047
5065
  }
5066
+ this.updatePending = false;
5048
5067
  return;
5049
5068
  }
5050
5069
  }
5070
+ atcb_cleanup(this.shadowRoot, this.identifier);
5051
5071
  await this.initButton();
5072
+ this.updatePending = false;
5052
5073
  }
5053
5074
  async initButton() {
5054
- if (!this.initialized) {
5055
- this.initialized = true;
5075
+ if (!this.state.initialized) {
5056
5076
  atcbBtnCount = atcbBtnCount + 1;
5057
5077
  }
5058
- if (this.identifier && this.identifier != '') {
5078
+ if (this.identifier && this.identifier !== '') {
5059
5079
  this.data.identifier = this.identifier;
5060
5080
  } else {
5061
- if (this.data.identifier && this.data.identifier != '') {
5081
+ if (this.data.identifier && this.data.identifier !== '') {
5062
5082
  if (!/^[\w\-_]+$/.test(this.data.identifier)) {
5063
5083
  this.data.identifier = '';
5064
5084
  if (this.debug) {
@@ -5203,10 +5223,10 @@ async function atcb_build_button(host, data) {
5203
5223
  throw new Error(e.message);
5204
5224
  }
5205
5225
  }
5206
- function atcb_cleanup(host, data) {
5226
+ function atcb_cleanup(host, identifier) {
5207
5227
  atcb_close(host);
5208
- atcb_unset_global_event_listener(data.identifier);
5209
- const schemaEl = document.getElementById('atcb-schema-' + data.identifier);
5228
+ atcb_unset_global_event_listener(identifier);
5229
+ const schemaEl = document.getElementById('atcb-schema-' + identifier);
5210
5230
  if (schemaEl) {
5211
5231
  schemaEl.remove();
5212
5232
  }
@@ -5216,7 +5236,7 @@ function atcb_cleanup(host, data) {
5216
5236
  .concat(Array.from(host.querySelectorAll('.atcb-placeholder')))
5217
5237
  .concat(Array.from(host.querySelectorAll('.atcb-button-wrapper')))
5218
5238
  .forEach((el) => el.remove());
5219
- delete atcbStates[`${data.identifier}`];
5239
+ delete atcbStates[`${identifier}`];
5220
5240
  }
5221
5241
  function atcb_set_light_mode(shadowRoot, data) {
5222
5242
  shadowRoot.host.classList.remove('atcb-dark', 'atcb-light', 'atcb-bodyScheme');
@@ -974,14 +974,14 @@ function tzlib_get_timezones(jsonType = false) {
974
974
  * Add to Calendar Button
975
975
  * ++++++++++++++++++++++
976
976
  *
977
- * Version: 2.6.2
977
+ * Version: 2.6.4
978
978
  * Creator: Jens Kuerschner (https://jekuer.com)
979
979
  * Project: https://github.com/add2cal/add-to-calendar-button
980
980
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
981
981
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
982
982
  *
983
983
  */
984
- const atcbVersion = '2.6.2';
984
+ const atcbVersion = '2.6.4';
985
985
  const atcbCssTemplate = {
986
986
  if (typeof window === 'undefined') {
987
987
  return false;
@@ -4959,12 +4959,20 @@ if (atcbIsBrowser()) {
4959
4959
  elem.innerHTML = template;
4960
4960
  this.attachShadow({ mode: 'open', delegateFocus: true });
4961
4961
  this.shadowRoot.append(elem.content.cloneNode(true));
4962
- this.loaded = false;
4963
- this.initialized = false;
4962
+ this.state = {
4963
+ initializing: false,
4964
+ initialized: false,
4965
+ ready: false,
4966
+ updatePending: false,
4967
+ };
4964
4968
  this.data = {};
4965
4969
  this.error = false;
4966
4970
  }
4967
4971
  async connectedCallback() {
4972
+ if (this.state.initializing || this.state.ready) {
4973
+ return;
4974
+ }
4975
+ this.state.initializing = true;
4968
4976
  const debugVal = this.getAttribute('debug');
4969
4977
  this.debug = this.hasAttribute('debug') && (!debugVal || debugVal === 'true' || debugVal === '') ? true : false;
4970
4978
  if ((this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') || (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '')) {
@@ -4985,19 +4993,23 @@ if (atcbIsBrowser()) {
4985
4993
  console.error(e);
4986
4994
  atcb_render_debug_msg(this.shadowRoot, e);
4987
4995
  }
4988
- this.loaded = true;
4996
+ this.state.initializing = false;
4997
+ this.state.ready = true;
4989
4998
  return;
4990
4999
  }
4991
5000
  }
4992
- this.loaded = true;
4993
5001
  await this.initButton();
5002
+ this.state.initializing = false;
5003
+ this.state.initialized = true;
5004
+ this.state.ready = true;
5005
+ return;
4994
5006
  }
4995
5007
  disconnectedCallback() {
4996
- atcb_cleanup(this.shadowRoot, this.data);
5008
+ atcb_cleanup(this.shadowRoot, this.identifier);
4997
5009
  if (this.debug) {
4998
- console.log('Add to Calendar Button "' + this.data.identifier + '" destroyed');
5010
+ console.log('Add to Calendar Button "' + this.identifier + '" destroyed');
4999
5011
  }
5000
- if (document.querySelectorAll('add-to-calendar-button').length == 0) {
5012
+ if (document.querySelectorAll('add-to-calendar-button').length === 0) {
5001
5013
  atcbBtnCount = 0;
5002
5014
  }
5003
5015
  }
@@ -5016,14 +5028,20 @@ if (atcbIsBrowser()) {
5016
5028
  })
5017
5029
  .concat(observeAdditionally);
5018
5030
  }
5019
- async attributeChangedCallback(name, oldValue, newValue) {
5020
- if (!this.loaded) {
5031
+ attributeChangedCallback(name, oldValue, newValue) {
5032
+ if (this.state.initializing || !this.state.ready) {
5021
5033
  return;
5022
5034
  }
5023
- if (this.debug && this.initialized) {
5035
+ if (this.debug && this.state.initialized) {
5024
5036
  console.log(`${name}'s value has been changed from ${oldValue} to ${newValue}`);
5025
5037
  }
5026
- atcb_cleanup(this.shadowRoot, this.data);
5038
+ if (!this.updatePending) {
5039
+ this.updatePending = true;
5040
+ setTimeout(() => this.updateComponent(), 0);
5041
+ }
5042
+ }
5043
+ async updateComponent() {
5044
+ if (!this.updatePending) return;
5027
5045
  this.data = {};
5028
5046
  this.shadowRoot.querySelector('.atcb-initialized').remove();
5029
5047
  const elem = document.createElement('template');
@@ -5033,7 +5051,7 @@ if (atcbIsBrowser()) {
5033
5051
  this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
5034
5052
  if (this.data.proKey) this.proKey = this.data.proKey;
5035
5053
  } else if (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '') {
5036
- this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
5054
+ this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
5037
5055
  if (this.data.proKey) this.proKey = this.data.proKey;
5038
5056
  }
5039
5057
  if (!this.data.name || this.data.name === '') {
@@ -5044,20 +5062,22 @@ if (atcbIsBrowser()) {
5044
5062
  console.error(e);
5045
5063
  atcb_render_debug_msg(this.shadowRoot, e);
5046
5064
  }
5065
+ this.updatePending = false;
5047
5066
  return;
5048
5067
  }
5049
5068
  }
5069
+ atcb_cleanup(this.shadowRoot, this.identifier);
5050
5070
  await this.initButton();
5071
+ this.updatePending = false;
5051
5072
  }
5052
5073
  async initButton() {
5053
- if (!this.initialized) {
5054
- this.initialized = true;
5074
+ if (!this.state.initialized) {
5055
5075
  atcbBtnCount = atcbBtnCount + 1;
5056
5076
  }
5057
- if (this.identifier && this.identifier != '') {
5077
+ if (this.identifier && this.identifier !== '') {
5058
5078
  this.data.identifier = this.identifier;
5059
5079
  } else {
5060
- if (this.data.identifier && this.data.identifier != '') {
5080
+ if (this.data.identifier && this.data.identifier !== '') {
5061
5081
  if (!/^[\w\-_]+$/.test(this.data.identifier)) {
5062
5082
  this.data.identifier = '';
5063
5083
  if (this.debug) {
@@ -5202,10 +5222,10 @@ async function atcb_build_button(host, data) {
5202
5222
  throw new Error(e.message);
5203
5223
  }
5204
5224
  }
5205
- function atcb_cleanup(host, data) {
5225
+ function atcb_cleanup(host, identifier) {
5206
5226
  atcb_close(host);
5207
- atcb_unset_global_event_listener(data.identifier);
5208
- const schemaEl = document.getElementById('atcb-schema-' + data.identifier);
5227
+ atcb_unset_global_event_listener(identifier);
5228
+ const schemaEl = document.getElementById('atcb-schema-' + identifier);
5209
5229
  if (schemaEl) {
5210
5230
  schemaEl.remove();
5211
5231
  }
@@ -5215,7 +5235,7 @@ function atcb_cleanup(host, data) {
5215
5235
  .concat(Array.from(host.querySelectorAll('.atcb-placeholder')))
5216
5236
  .concat(Array.from(host.querySelectorAll('.atcb-button-wrapper')))
5217
5237
  .forEach((el) => el.remove());
5218
- delete atcbStates[`${data.identifier}`];
5238
+ delete atcbStates[`${identifier}`];
5219
5239
  }
5220
5240
  function atcb_set_light_mode(shadowRoot, data) {
5221
5241
  shadowRoot.host.classList.remove('atcb-dark', 'atcb-light', 'atcb-bodyScheme');
@@ -974,14 +974,14 @@ function tzlib_get_timezones(jsonType = false) {
974
974
  * Add to Calendar Button
975
975
  * ++++++++++++++++++++++
976
976
  *
977
- * Version: 2.6.2
977
+ * Version: 2.6.4
978
978
  * Creator: Jens Kuerschner (https://jekuer.com)
979
979
  * Project: https://github.com/add2cal/add-to-calendar-button
980
980
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
981
981
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
982
982
  *
983
983
  */
984
- const atcbVersion = '2.6.2';
984
+ const atcbVersion = '2.6.4';
985
985
  const atcbCssTemplate = {};
986
986
  const atcbIsBrowser = () => {
987
987
  if (typeof window === 'undefined') {
@@ -5652,12 +5652,20 @@ if (atcbIsBrowser()) {
5652
5652
  elem.innerHTML = template;
5653
5653
  this.attachShadow({ mode: 'open', delegateFocus: true });
5654
5654
  this.shadowRoot.append(elem.content.cloneNode(true));
5655
- this.loaded = false;
5656
- this.initialized = false;
5655
+ this.state = {
5656
+ initializing: false,
5657
+ initialized: false,
5658
+ ready: false,
5659
+ updatePending: false,
5660
+ };
5657
5661
  this.data = {};
5658
5662
  this.error = false;
5659
5663
  }
5660
5664
  async connectedCallback() {
5665
+ if (this.state.initializing || this.state.ready) {
5666
+ return;
5667
+ }
5668
+ this.state.initializing = true;
5661
5669
  const debugVal = this.getAttribute('debug');
5662
5670
  this.debug = this.hasAttribute('debug') && (!debugVal || debugVal === 'true' || debugVal === '') ? true : false;
5663
5671
  if ((this.hasAttribute('proKey') && this.getAttribute('proKey') !== '') || (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '')) {
@@ -5678,19 +5686,23 @@ if (atcbIsBrowser()) {
5678
5686
  console.error(e);
5679
5687
  atcb_render_debug_msg(this.shadowRoot, e);
5680
5688
  }
5681
- this.loaded = true;
5689
+ this.state.initializing = false;
5690
+ this.state.ready = true;
5682
5691
  return;
5683
5692
  }
5684
5693
  }
5685
- this.loaded = true;
5686
5694
  await this.initButton();
5695
+ this.state.initializing = false;
5696
+ this.state.initialized = true;
5697
+ this.state.ready = true;
5698
+ return;
5687
5699
  }
5688
5700
  disconnectedCallback() {
5689
- atcb_cleanup(this.shadowRoot, this.data);
5701
+ atcb_cleanup(this.shadowRoot, this.identifier);
5690
5702
  if (this.debug) {
5691
- console.log('Add to Calendar Button "' + this.data.identifier + '" destroyed');
5703
+ console.log('Add to Calendar Button "' + this.identifier + '" destroyed');
5692
5704
  }
5693
- if (document.querySelectorAll('add-to-calendar-button').length == 0) {
5705
+ if (document.querySelectorAll('add-to-calendar-button').length === 0) {
5694
5706
  atcbBtnCount = 0;
5695
5707
  }
5696
5708
  }
@@ -5709,14 +5721,20 @@ if (atcbIsBrowser()) {
5709
5721
  })
5710
5722
  .concat(observeAdditionally);
5711
5723
  }
5712
- async attributeChangedCallback(name, oldValue, newValue) {
5713
- if (!this.loaded) {
5724
+ attributeChangedCallback(name, oldValue, newValue) {
5725
+ if (this.state.initializing || !this.state.ready) {
5714
5726
  return;
5715
5727
  }
5716
- if (this.debug && this.initialized) {
5728
+ if (this.debug && this.state.initialized) {
5717
5729
  console.log(`${name}'s value has been changed from ${oldValue} to ${newValue}`);
5718
5730
  }
5719
- atcb_cleanup(this.shadowRoot, this.data);
5731
+ if (!this.updatePending) {
5732
+ this.updatePending = true;
5733
+ setTimeout(() => this.updateComponent(), 0);
5734
+ }
5735
+ }
5736
+ async updateComponent() {
5737
+ if (!this.updatePending) return;
5720
5738
  this.data = {};
5721
5739
  this.shadowRoot.querySelector('.atcb-initialized').remove();
5722
5740
  const elem = document.createElement('template');
@@ -5726,7 +5744,7 @@ if (atcbIsBrowser()) {
5726
5744
  this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
5727
5745
  if (this.data.proKey) this.proKey = this.data.proKey;
5728
5746
  } else if (this.hasAttribute('prokey') && this.getAttribute('prokey') !== '') {
5729
- this.data = await atcb_get_pro_data(this.getAttribute('proKey'), this);
5747
+ this.data = await atcb_get_pro_data(this.getAttribute('prokey'), this);
5730
5748
  if (this.data.proKey) this.proKey = this.data.proKey;
5731
5749
  }
5732
5750
  if (!this.data.name || this.data.name === '') {
@@ -5737,20 +5755,22 @@ if (atcbIsBrowser()) {
5737
5755
  console.error(e);
5738
5756
  atcb_render_debug_msg(this.shadowRoot, e);
5739
5757
  }
5758
+ this.updatePending = false;
5740
5759
  return;
5741
5760
  }
5742
5761
  }
5762
+ atcb_cleanup(this.shadowRoot, this.identifier);
5743
5763
  await this.initButton();
5764
+ this.updatePending = false;
5744
5765
  }
5745
5766
  async initButton() {
5746
- if (!this.initialized) {
5747
- this.initialized = true;
5767
+ if (!this.state.initialized) {
5748
5768
  atcbBtnCount = atcbBtnCount + 1;
5749
5769
  }
5750
- if (this.identifier && this.identifier != '') {
5770
+ if (this.identifier && this.identifier !== '') {
5751
5771
  this.data.identifier = this.identifier;
5752
5772
  } else {
5753
- if (this.data.identifier && this.data.identifier != '') {
5773
+ if (this.data.identifier && this.data.identifier !== '') {
5754
5774
  if (!/^[\w\-_]+$/.test(this.data.identifier)) {
5755
5775
  this.data.identifier = '';
5756
5776
  if (this.debug) {
@@ -5895,10 +5915,10 @@ async function atcb_build_button(host, data) {
5895
5915
  throw new Error(e.message);
5896
5916
  }
5897
5917
  }
5898
- function atcb_cleanup(host, data) {
5918
+ function atcb_cleanup(host, identifier) {
5899
5919
  atcb_close(host);
5900
- atcb_unset_global_event_listener(data.identifier);
5901
- const schemaEl = document.getElementById('atcb-schema-' + data.identifier);
5920
+ atcb_unset_global_event_listener(identifier);
5921
+ const schemaEl = document.getElementById('atcb-schema-' + identifier);
5902
5922
  if (schemaEl) {
5903
5923
  schemaEl.remove();
5904
5924
  }
@@ -5908,7 +5928,7 @@ function atcb_cleanup(host, data) {
5908
5928
  .concat(Array.from(host.querySelectorAll('.atcb-placeholder')))
5909
5929
  .concat(Array.from(host.querySelectorAll('.atcb-button-wrapper')))
5910
5930
  .forEach((el) => el.remove());
5911
- delete atcbStates[`${data.identifier}`];
5931
+ delete atcbStates[`${identifier}`];
5912
5932
  }
5913
5933
  function atcb_set_light_mode(shadowRoot, data) {
5914
5934
  shadowRoot.host.classList.remove('atcb-dark', 'atcb-light', 'atcb-bodyScheme');