Skip to content

Commit

Permalink
gsuiToggle: use of gsui0ne
Browse files Browse the repository at this point in the history
  • Loading branch information
mr21 committed Feb 10, 2024
1 parent 5beff05 commit f5bfe09
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gs-utils
Submodule gs-utils updated 1 files
+15 −0 gs-utils.js
21 changes: 10 additions & 11 deletions gsuiToggle/gsuiToggle.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
"use strict";

class gsuiToggle extends HTMLElement {
class gsuiToggle extends gsui0ne {
constructor() {
super();
super( {
$cmpName: "gsuiToggle",
$tagName: "gsui-toggle",
$attributes: { tabindex: 0 }
} );
Object.seal( this );
this.oncontextmenu = () => false;
this.oncontextmenu = GSUnoopFalse;
this.onmousedown = e => {
if ( e.button === 2 ) {
GSUdispatchEvent( this, "gsuiToggle", "toggleSolo" );
this.$dispatch( "toggleSolo" );
} else if ( e.button === 0 ) {
const off = GSUgetAttribute( this, "off" ) !== null;
const off = GSUhasAttribute( this, "off" );

GSUsetAttribute( this, "off", !off );
GSUdispatchEvent( this, "gsuiToggle", "toggle", off );
this.$dispatch( "toggle", off );
}
};
}

// .........................................................................
connectedCallback() {
GSUsetAttribute( this, "tabindex", 0 );
}
}

Object.freeze( gsuiToggle );
Expand Down
1 change: 1 addition & 0 deletions gsuiToggle/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<script src="/gs-ui-components/test-assets/test.js"></script>

<!-- ....................................................................... -->
<script src="/gs-ui-components/gsui0ne/gsui0ne.js"></script>
<script src="/gs-ui-components/gsuiToggle/gsuiToggle.js"></script>

</body>
Expand Down

0 comments on commit f5bfe09

Please sign in to comment.