-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
6c234cd
commit 977b60c
Showing
1 changed file
with
32 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# tasker-types | ||
Typescript definitions for Tasker functions | ||
|
||
Provides type definitions for [Tasker](https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm)'s built in JavaScript(let) functions to help with developing Tasker JavaScript(lets) when using TypeScript and VSCode (or other TS Language Server). | ||
|
||
This module exports Tasker's built in `tk` object if running from Tasker, or exports a dummy (empty object) otherwise. | ||
|
||
Based on the [Tasker Userguide](https://tasker.joaoapps.com/userguide/en/javascript.html) | ||
|
||
# Getting Started | ||
Add tasker-types to your project using: | ||
``` | ||
npm i --save tasker-types | ||
``` | ||
|
||
In a TypeScript file, import `tk` from tasker types. You now have type definitions and autocomplete in | ||
|
||
Example: | ||
``` | ||
import { tk as tasker } from "tasker-types"; | ||
tasker.mediaVol(5, true, true); | ||
tasker.flashLong(Math.floor(Math.random() * 100).toString()); | ||
tasker.exit(); | ||
``` | ||
|
||
This example imports `tk` (the Tasker library object) and aliases it to `tasker`.\ | ||
`tasker.mediaVol(5, true, true)` sets the media volume to 5, displays the new volume on screen and plays a sound.\ | ||
`tasker.flashLong(Math.floor(Math.random() * 100).toString())` flashes a random number on the screen.\ | ||
`tasker.exit()` ends the JS and continues to the next action in the task. |