Getting started
Enviroment Setup
1) Using CDN:
The easiest way of adding KotasJS to your projects, is via CD
Just add this tag into your HTML, just before your actual script tag, and everything is done!
<script src="https://cdn.jsdelivr.net/gh/borecjeborec1/kotasjs/cdn/kotasjs.min.js"></script>
https://cdn.jsdelivr.net/gh/borecjeborec1/kotasjs/cdn/kotasjs.min.js
2) Download with NPM:
If you are using some npm based frameworks like React, Vue, Svelte, etc. then you can install the
package with this command:
npm install kotasjs
3) Source code Download:
This is the hardest variant for maintain, cause you have a script more. But if you want, just grap the code
from
Github, and download the
KotasJS.js file.
JavaScript Setup
After linking your JS file to your HTML file, you should initialize the KotasJS class.
const kotas = new KotasJS()
Now you have fully functional kotas instance, which you can use.
Examples
Hello World!
Let's start with the basics. Create a simple hello world app with KotasJS.
index.html
Whats going on here? Just a basic HTML structure with including our scrips. The funny part will be in our
script.js!
script.js
And what going on here? At first we initialized our KotasJS class and set that instance as constant
variable kotas.
Our kotas, has only one public method - on. This method let us capture all of the available events.
See Syntax
All the coding is done! Everytime you swipe left (without any key pressed), the "Hello world!" message will
pop out!
Source code: Github
Syntaxes
on
LepikJS has only one public method - on. This on method allows you to listen to different events.
| Event |
Aliases |
ID |
Use case |
| swipe_down |
down |
0 |
kotas.on("swipe_down",(e)=>alert(e.event)) |
| swipe_up |
up |
1 |
kotas.on("swipe_up",(e)=>alert(e.event)) |
| swipe_left |
left |
2 |
kotas.on("swipe_left",(e)=>alert(e.event)) |
| swipe_right |
right |
3 |
kotas.on("swipe_right",(e)=>alert(e.event)) |
More events coming in the future. Like Circle,L shape, Triange, etc...
FAQ
Will there be more events?
Absolutely, I'm currently working on implementing circle shaped move. But some L shaped and triangles are
coming soon too!
Does KotasJS support global mouse?
Currently no, but KotasJS-global, will come soon!
What if I find a bug?
I would really appreciate getting feedback here.