Skip to content

Commit

Permalink
feat(customization): allow for CE class extension and customization #151
Browse files Browse the repository at this point in the history


Changes to be committed:
modified:   demo/index.html
modified:   src/define.js
deleted:    src/defineCustom.js
modified:   test/auro-hyperlink.test.js
  • Loading branch information
jason-capsule42 authored and blackfalcon committed Jan 25, 2023
1 parent ace7561 commit 1b19178
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
4 changes: 1 addition & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
Prism.highlightAll();
});
</script>
<script type="module" src="../src/auro-hyperlink.js"></script>
<script type="module" src="../src/define.js"></script>
<script type="module" src="../src/defineCustom.js"></script>
<script type="module" src="./../src/define.js"></script>

<!-- If additional elements are needed for the demo, add them here. -->
<script src="https://unpkg.com/@alaskaairux/auro-accordion@latest/dist/auro-accordion__bundled.js" type="module"></script>
Expand Down
9 changes: 7 additions & 2 deletions src/define.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { AuroHyperlink } from './auro-hyperlink.js';

if (!customElements.get("auro-hyperlink")) {
customElements.define("auro-hyperlink", AuroHyperlink);
export function registerComponent(name = 'custom-hyperlink') {
// alias definition
if (!customElements.get(name)) {
customElements.define(name, class extends AuroHyperlink {});
}
}

registerComponent('auro-hyperlink');
9 changes: 0 additions & 9 deletions src/defineCustom.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/auro-hyperlink.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fixture, html, expect } from '@open-wc/testing';
import '../src/auro-hyperlink.js';
import './../src/define.js';

describe('auro-hyperlink', () => {

Expand Down

0 comments on commit 1b19178

Please sign in to comment.