diff --git a/src/relative-time-element.js b/src/relative-time-element.js index 1aa612a..772f887 100644 --- a/src/relative-time-element.js +++ b/src/relative-time-element.js @@ -54,5 +54,7 @@ function updateNowElements() { // var time = new RelativeTimeElement() // # => // -window.RelativeTimeElement = RelativeTimeElement -window.customElements.define('relative-time', RelativeTimeElement) +if (!window.customElements.get('relative-time')) { + window.RelativeTimeElement = RelativeTimeElement + window.customElements.define('relative-time', RelativeTimeElement) +} diff --git a/src/time-ago-element.js b/src/time-ago-element.js index b9f7f06..068ed0b 100644 --- a/src/time-ago-element.js +++ b/src/time-ago-element.js @@ -14,5 +14,7 @@ export default class TimeAgoElement extends RelativeTimeElement { } } -window.TimeAgoElement = TimeAgoElement -window.customElements.define('time-ago', TimeAgoElement) +if (!window.customElements.get('time-ago')) { + window.TimeAgoElement = TimeAgoElement + window.customElements.define('time-ago', TimeAgoElement) +} diff --git a/src/time-until-element.js b/src/time-until-element.js index b860494..0949e50 100644 --- a/src/time-until-element.js +++ b/src/time-until-element.js @@ -14,5 +14,7 @@ export default class TimeUntilElement extends RelativeTimeElement { } } -window.TimeUntilElement = TimeUntilElement -window.customElements.define('time-until', TimeUntilElement) +if (!window.customElements.get('time-until')) { + window.TimeUntilElement = TimeUntilElement + window.customElements.define('time-until', TimeUntilElement) +}