Skip to content

Commit

Permalink
fixes #67
Browse files Browse the repository at this point in the history
  • Loading branch information
SteinerPascal committed Sep 13, 2022
1 parent d5f44f9 commit 60e78c6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
9 changes: 5 additions & 4 deletions src/index.html
Expand Up @@ -119,11 +119,12 @@
yasqe.setValue(queryString);
},
// triggered when "play" button is clicked
onSubmit: function(sparnat) {
onSubmit: ()=> {
sparnatural.disablePlayBtn();
// trigger the query from YasQE
yasqe.query();
sparnat.onQuerySubmitted();
}

},
}
sparnatural.settings = settings
})
Expand Down Expand Up @@ -156,7 +157,7 @@
// link yasqe and yasr
yasqe.on("queryResponse", function(_yasqe, response, duration) {
yasr.setResponse(response, duration);
sparnatural.onQueryFinished() ;
sparnatural.enablePlayBtn() ;
});
</script>
</body>
Expand Down
8 changes: 8 additions & 0 deletions src/sparnatural.ts
Expand Up @@ -58,6 +58,14 @@ class SparNatural extends HTMLElement {
$(this).append(this.Sparnatural.html);
this.Sparnatural.render();
}

enablePlayBtn(){
this.Sparnatural.enablePlayBtn()
}

disablePlayBtn(){
this.Sparnatural.disablePlayBtn()
}
}

customElements.get("spar-natural") ||
Expand Down
14 changes: 9 additions & 5 deletions src/sparnatural/components/Sparnatural.ts
Expand Up @@ -24,6 +24,7 @@ class Sparnatural extends HTMLComponent {
filter = $(
'<svg data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 0 0" style="width:0;height:0;display:block"><defs><filter style="color-interpolation-filters:sRGB;" inkscape:label="Drop Shadow" id="filter19278" x="-0.15483875" y="-0.11428573" width="1.3096775" height="1.2714286"><feFlood flood-opacity="0.811765" flood-color="rgb(120,120,120)" result="flood" id="feFlood19268" /><feComposite in="flood" in2="SourceGraphic" operator="out" result="composite1" id="feComposite19270" /><feGaussianBlur in="composite1" stdDeviation="2" result="blur" id="feGaussianBlur19272" /><feOffset dx="3.60822e-16" dy="1.8" result="offset" id="feOffset19274" /><feComposite in="offset" in2="SourceGraphic" operator="atop" result="composite2" id="feComposite19276" /></filter></defs></svg>'
);

constructor() {
//Sparnatural: Does not have a ParentComponent!
super("Sparnatural", null, null);
Expand Down Expand Up @@ -70,12 +71,15 @@ class Sparnatural extends HTMLComponent {
// initStatistics(specProvider);
}

onQuerySubmitted() {
this.SubmitSection.playBtn.enableLoading();
// method is exposed from the HTMLElement
enablePlayBtn = () =>{
this.SubmitSection.playBtn.enable();
}

onQueryFinished() {
this.SubmitSection.playBtn.disableLoading();

// method is exposed from the HTMLElement
disablePlayBtn = () => {
this.SubmitSection.playBtn.disable();
}

}
export default Sparnatural;
4 changes: 2 additions & 2 deletions src/sparnatural/components/buttons/PlayBtn.ts
Expand Up @@ -16,11 +16,11 @@ class PlayBtn extends HTMLComponent {
return this;
}

enableLoading() {
disable() {
this.widgetHtml.addClass('submitDisable loadingEnabled');
}

disableLoading() {
enable() {
this.widgetHtml.removeClass('loadingEnabled');
}
}
Expand Down

0 comments on commit 60e78c6

Please sign in to comment.