-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Raj Nandan Sharma
authored and
Raj Nandan Sharma
committed
Dec 25, 2022
1 parent
0f820fe
commit 9c88761
Showing
6 changed files
with
92 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ You can register any key. To trigger, it will bind an event with your specified | |
## Installation | ||
From CDN | ||
``` | ||
<script src="https://cdn.jsdelivr.net/gh/rajnandan1/[email protected].6/dist/floodlight.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/rajnandan1/[email protected].7/dist/floodlight.min.js"></script> | ||
``` | ||
From NPM | ||
``` | ||
|
@@ -35,6 +35,26 @@ if (typeof window !== 'undefined') { | |
let fl = floodlight(); | ||
} | ||
``` | ||
## Basic Usage - Implement a call to a function a | ||
|
||
The below code implements a function that will trigger an alert box with a Hello World. It will listen for the a key. When someone presses a it will run. | ||
``` | ||
let fl = new FloodLight(); | ||
//this takes to parameters. first parameter is the `key`, second is the description | ||
let cmdHelloWorld = fl.addCommand("a", "Alert hello world"); | ||
//Implement a function that would handle the query | ||
let helloWorld = function() { | ||
alert("hello world") | ||
}; | ||
//Add the action for a command. Takes a function as first param | ||
cmd.addAction(helloWorld); | ||
//Start floodlight. It will start listening | ||
fl.run(); | ||
``` | ||
## Basic Usage - Implement a quick google search `g` | ||
|
||
The below code implements a google search using floodgate. It will listen for the `g` key. When someone presses `g` it will show a search box. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.