@@ -30,22 +30,45 @@ export const databases = ['mirbase'];
3030// reactRoot
3131// );
3232
33- const proto = Object . create ( HTMLElement . prototype , {
34- attachedCallback : {
35- value : function ( ) {
36- const mountPoint = document . createElement ( 'div' ) ;
37- const shadowRoot = this . createShadowRoot ( ) ;
38- shadowRoot . appendChild ( mountPoint ) ;
39- ReactDOM . render ( [
40- < link key = 'styles' href = "RNAcentral-sequence-search.css" rel = "stylesheet" /> ,
41- < Provider key = 'provider' store = { store } >
42- < SequenceSearch databases = { databases } />
43- </ Provider > ] ,
44- mountPoint
45- ) ;
46- retargetEvents ( shadowRoot ) ;
47- }
33+
34+ class RNAcentralSequenceSearch extends HTMLElement {
35+ constructor ( ) {
36+ super ( ) ;
37+
38+ const mountPoint = document . createElement ( 'div' ) ;
39+ const shadowRoot = this . attachShadow ( { mode : 'open' } ) ;
40+ shadowRoot . appendChild ( mountPoint ) ;
41+ ReactDOM . render ( [
42+ < link key = 'styles' href = "RNAcentral-sequence-search.css" rel = "stylesheet" /> ,
43+ < Provider key = 'provider' store = { store } >
44+ < SequenceSearch databases = { databases } />
45+ </ Provider > ] ,
46+ mountPoint
47+ ) ;
48+ retargetEvents ( shadowRoot ) ;
4849 }
49- } ) ;
50+ }
51+
52+ customElements . define ( 'rnacentral-sequence-search' , RNAcentralSequenceSearch ) ;
53+
54+
55+
56+ // const proto = Object.create(HTMLElement.prototype, {
57+ // attachedCallback: {
58+ // value: function() {
59+ // const mountPoint = document.createElement('div');
60+ // const shadowRoot = this.createShadowRoot();
61+ // shadowRoot.appendChild(mountPoint);
62+ // ReactDOM.render([
63+ // <link key='styles' href="RNAcentral-sequence-search.css" rel="stylesheet" />,
64+ // <Provider key='provider' store={store}>
65+ // <SequenceSearch databases={databases}/>
66+ // </Provider>],
67+ // mountPoint
68+ // );
69+ // retargetEvents(shadowRoot);
70+ // }
71+ // }
72+ // });
5073
51- document . registerElement ( 'RNAcentral-sequence-search' , { prototype : proto } ) ;
74+ // document.registerElement('RNAcentral-sequence-search', {prototype: proto});
0 commit comments