Created
January 13, 2019 17:42
-
-
Save airboss001/9eb61f8840f2698f8c71b64b66c4d541 to your computer and use it in GitHub Desktop.
triple click
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .demo { | |
| border: 1px solid lightgray; | |
| padding: 1rem; | |
| margin: 1rem; | |
| text-align: center; | |
| user-select: none; | |
| -moz-user-select: none; | |
| -webkit-user-select: none; | |
| -ms-user-select: none; | |
| } | |
| .demo.dark { | |
| background-color: lightgray; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <require from="./app.css"></require> | |
| <div class="demo ${dark ? 'dark' : ''}" click.trigger="toggleBackground($event)">Triple click to change background</div> | |
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class App { | |
| dark = false; | |
| throttleClick = false; | |
| lastTimeStamp = 0; | |
| toggleBackground(event) { | |
| if((event.timeStamp - this.lastTimeStamp) > 400) { | |
| this.clickCounter = 1; | |
| } | |
| else { | |
| this.clickCounter++; | |
| } | |
| this.lastTimeStamp = event.timeStamp; | |
| if (this.throttleClick || this.clickCounter !== 3) return; | |
| this.throttleClick = true; | |
| setTimeout( () => { | |
| this.throttleClick = false; | |
| }, 5000); | |
| this.dark = !this.dark; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>Aurelia</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| </head> | |
| <body aurelia-app> | |
| <h1>Loading...</h1> | |
| <script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script> | |
| <script src="https://jdanyow.github.io/rjs-bundle/config.js"></script> | |
| <script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script> | |
| <script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script> | |
| <script> | |
| require(['aurelia-bootstrapper']); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment