Commit c9ba4f76 authored by Tim Zallmann's avatar Tim Zallmann

Moved Class to its own class

parent 17ad4f8f
import 'document-register-element'; import 'document-register-element';
import isEmojiUnicodeSupported from '../emoji/support'; import isEmojiUnicodeSupported from '../emoji/support';
export default function installGlEmojiElement() { class GlEmoji extends HTMLElement {
if (!customElements.get('gl-emoji')) {
customElements.define(
'gl-emoji',
class extends HTMLElement {
constructor() { constructor() {
super(); super();
...@@ -18,11 +14,7 @@ export default function installGlEmojiElement() { ...@@ -18,11 +14,7 @@ export default function installGlEmojiElement() {
const hasImageFallback = fallbackSrc && fallbackSrc.length > 0; const hasImageFallback = fallbackSrc && fallbackSrc.length > 0;
const hasCssSpriteFalback = fallbackSpriteClass && fallbackSpriteClass.length > 0; const hasCssSpriteFalback = fallbackSpriteClass && fallbackSpriteClass.length > 0;
if ( if (emojiUnicode && isEmojiUnicode && !isEmojiUnicodeSupported(emojiUnicode, unicodeVersion)) {
emojiUnicode &&
isEmojiUnicode &&
!isEmojiUnicodeSupported(emojiUnicode, unicodeVersion)
) {
// CSS sprite fallback takes precedence over image fallback // CSS sprite fallback takes precedence over image fallback
if (hasCssSpriteFalback) { if (hasCssSpriteFalback) {
if (!gon.emoji_sprites_css_added && gon.emoji_sprites_css_path) { if (!gon.emoji_sprites_css_added && gon.emoji_sprites_css_path) {
...@@ -51,7 +43,10 @@ export default function installGlEmojiElement() { ...@@ -51,7 +43,10 @@ export default function installGlEmojiElement() {
} }
} }
} }
}, }
);
export default function installGlEmojiElement() {
if (!customElements.get('gl-emoji')) {
customElements.define('gl-emoji', GlEmoji);
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment