A standard library to interact with KaiOS 2.x and 3.x APIs.

Overview

kaios-lib

CircleCI npm

A standard library to interact with KaiOS 2.x and 3.x* APIs.

* 3.x support coming when there is a good dev device available for testing purposes

Examples

Activity

// Create the service
const activity = new KaiOS.Activity({
  name: 'toolbox/qr-to-text',
  data: {},
});

// Send the request and await the result
const result = await activity.start();

Alarm

// Create the service
const alarms = new KaiOS.Alarm();

// Add an alarm
await alarms.add({
  date: new Date(Date.now() + 1000 * 10),
  respectTimezone: true,
  data: { name: 'Garrett' },
});

// List all alarms
const all = await alarms.getAll();
console.log('alarms', all);

// Subscribe to when an alarm is fired
alarms.subscribe((data) => console.log('alarm fired', data));

App

// Example coming soon

Battery

// Create the service
const battery = new KaiOS.Battery();

// Get the current battery status
const current = await battery.current();

// Subscribe to changes (fires on level and charging change)
battery.subscribe((status) => console.log('battery status', status));

// Unsubscribe when you don't need it anymore
battery.unsubscribe();

FileStorage

// Example coming soon

Geolocation

// Create the service
const geolocation = new KaiOS.Geolocation();

// Get current position
const current = await geolocation.current();

// Subscribe to changes
geolocation.subscribe((position) => {
  console.log('got position', position);
});

// Unsubscribe when you don't need it anymore
geolocation.unsubscribe();

LocalStorage

// Create the service
const localStorage = new KaiOS.LocalStorage();

// Write to storage. Will use `JSON.stringify` on object passed in
localStorage.setItem('myKey', { name: 'Garrett' });

// Retrieve data
const data = localStorage.getItem('myKey');

Network

// Create the service
const network = new KaiOS.Network();

// Get current status
const current = await network.current();

// Subscribe to changes
network.subscribe((status) => console.log('got status', status));

// Unsubscribe when you don't need it anymore
network.unsubscribe();

Volume

// Create the service
const volume = new KaiOS.Volume();

await volume.show();
await volume.up();
await volume.down();
You might also like...

Browse local files using the non-standard Web Browser File System Access API

Browse local files using the non-standard Web Browser File System Access API

Browse local files using the non-standard Web Browser File System Access API

Oct 26, 2022

[Experimental] Browse local files using the non-standard File System Access API

[Experimental] Browse local files using the non-standard File System Access API

jupyterlab-filesystem-access Browse local files using the non-standard Web Browser File System Access API. ⚠️ This extension is compatible with Chromi

Apr 14, 2022

[Experimental] Browse local files using the non-standard File System Access API

[Experimental] Browse local files using the non-standard File System Access API

jupyterlab-filesystem-access Browse local files using the non-standard Web Browser File System Access API. ⚠️ This extension is compatible with Chromi

Apr 15, 2022

🔨 A more engineered, highly customizable, standard output format commitizen adapter.

🔨 A more engineered, highly customizable, standard output format commitizen adapter.

cz-git Github | Installation | Website | 简体中文文档 Introduction A more engineered, highly customizable, standard output format commitizen adapter. What i

Dec 31, 2022

A new, simple NFT standard for Solana

New Solana NFT Standard Current Issues The current NFT spec is pretty bad for a few reasons: every NFT requires multiple accounts (3+) the token accou

Oct 20, 2022

Fullstack Dynamic NFT Mini Game built using 💎 Diamond Standard [EIP 2535] 🏃‍♀️Players can use Hero NFT to battle against Thanos ⚔ Heroes can be Healed by staking their NFT 🛡

Fullstack Dynamic NFT Mini Game built using 💎 Diamond Standard [EIP 2535]  🏃‍♀️Players can use Hero NFT to battle against Thanos ⚔ Heroes can be Healed by staking their NFT 🛡

💎 Fullstack Dynamic NFT Mini Game 🎮 💎 Using Diamond Standard Play On 💎 🎮 ⏩ http://diamond-dapp.vercel.app/ Project Description 📝 Fullstack Dynam

Dec 23, 2022

Responsive, auto-saving To-Do List made from scratch using JavaScript only, but refactoring the code into ES6 standard

Project Name ES6 AWESOME BOOKS Website Name AWSM BOOKS Project Website (GitHub Pages) https://github.com/Zeraltz/es6-awsm-books Clone the Project git

Jun 25, 2022

Lazy minting of ERC721 NFTs using EIP712 standard for typed, structured data. ✨

ERC721 - Signature minting Lazy minting of ERC721 NFTs using EIP712 standard for typed, structured data. ✨ How it works Lazy minting or Signature mint

Oct 20, 2022

A W3C standard compliant Web rendering engine based on Flutter.

A W3C standard compliant Web rendering engine based on Flutter.

WebF WebF (Web on the Flutter) is a W3C standard compliant Web rendering engine based on Flutter, it can run web application on Flutter natively. W3C

Dec 25, 2022
Releases(v1.6.0)
Owner
Garrett Downs
Web dev. Built many things for many different devices and platforms.
Garrett Downs
✨ Standard library for JavaScript and Node.js. ✨

stdlib (/ˈstændərd lɪb/ "standard lib") is a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing appli

stdlib 3.1k Dec 31, 2022
A javascript standard data structure library which benchmark against C++ STL.

js-sdsl A javascript standard data structure library which benchmark against C++ STL. Note Note that our official version starts from 2.0.0. In order

Zilong Yao 5 Dec 10, 2022
Web3 NPM library to interact with Soonaverse.

Soonaverse - Soonaverse JavaScript/Typescript API - APLHA Please note this is APLHA and we might introduce breaking changes. Library to interact with

SoonLabs 15 Oct 28, 2022
Web3 NPM library to interact with Soonaverse.

Soonaverse - Soonaverse JavaScript/Typescript API - APLHA Please note this is APLHA and we might introduce breaking changes. Library to interact with

Soonaverse 12 Apr 27, 2022
JavaScript library to interact with the Cfx.re API (FiveM/RedM)

Cfx.re JavaScript API A package that helps you interacting with the Cfx.re, FiveM & RedM API. How to install npm i cfx-api Example usage: const cfx =

Pablo Zapata 21 Jan 1, 2023
JavaScript library to interact with the Cfx.re API (FiveM/RedM)

Cfx.re JavaScript API A package that helps you interacting with the Cfx.re, FiveM & RedM API. How to install npm i cfx-api Example usage: const cfx =

Pablo Zapata 14 Aug 14, 2022
A plugin that uses multiple block, Tailwind and is fully integrated into the standard build process

Tailwind CSS Custom Block Plugin This repo leverages the @wordpress/scripts package and it's ability to use PostCSS to introduce TailwindCSS to the bu

Ryan Welcher 3 Dec 31, 2022
On this page, you can save and load all the awesome books you have and save the name and the author into the local storage. this project uses Javascript to interact with the pages

Awesome Books: refactor to use JavaScript classes In this project, We add the links to the applications into the final project Getting Started if you

Cesar Valencia 8 Nov 29, 2022
Hexo-backlink - This plugin is for transfer Obsidian-type backlink to standard hexo in-site post link.

Hexo-Backlink A plugin to convert backlink in .md file to in-site link. Install npm install hexo-backlink configuration Add backlink:true in _config.y

null 8 Sep 27, 2022
The coding-standard for JavaScript projects.

JavaScript Coding Standard A set of ESLint rules applied to all Croct JavaScript projects. ?? Releases · ?? Report Bug · ✨ Request Feature Installatio

Croct 4 Dec 15, 2022