fix global vars inside IDE (only cli to go)
parent
83d445c1a2
commit
45bd654eca
|
|
@ -1,5 +1,3 @@
|
||||||
"use strict";
|
|
||||||
exports.__esModule = true;
|
|
||||||
(function () {
|
(function () {
|
||||||
var icon = require('heatshrink').decompress(atob('ikggMAiEAgYIBmEAg4EB+EAh0AgPggEeCAIEBnwQBAgP+gEP//x///j//8f//k///H//4BYOP/4lBv4bDvwEB4EAvAEBwEAuA7DCAI7BgAQBhEAA'));
|
var icon = require('heatshrink').decompress(atob('ikggMAiEAgYIBmEAg4EB+EAh0AgPggEeCAIEBnwQBAgP+gEP//x///j//8f//k///H//4BYOP/4lBv4bDvwEB4EAvAEBwEAuA7DCAI7BgAQBhEAA'));
|
||||||
var iconWidth = 18;
|
var iconWidth = 18;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import { loadGlobals } from '../../typescript/types/globals'; // TODO find a nicer way to load ambient type definitions than this
|
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
const icon = require('heatshrink').decompress(
|
const icon = require('heatshrink').decompress(
|
||||||
atob(
|
atob(
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,9 @@
|
||||||
"name": "Bangle.ts",
|
"name": "Bangle.ts",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "16.11.12",
|
|
||||||
"typescript": "4.5.2"
|
"typescript": "4.5.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
|
||||||
"version": "16.11.12",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.12.tgz",
|
|
||||||
"integrity": "sha512-+2Iggwg7PxoO5Kyhvsq9VarmPbIelXP070HMImEpbtGCoyWNINQj4wzjbQCXzdHTRXnqufutJb5KAURZANNBAw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "4.5.2",
|
"version": "4.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
|
||||||
|
|
@ -33,12 +26,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": {
|
|
||||||
"version": "16.11.12",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.12.tgz",
|
|
||||||
"integrity": "sha512-+2Iggwg7PxoO5Kyhvsq9VarmPbIelXP070HMImEpbtGCoyWNINQj4wzjbQCXzdHTRXnqufutJb5KAURZANNBAw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "4.5.2",
|
"version": "4.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
"author": "Sebastian Di Luzio <sebastian@diluz.io> (https://diluz.io)",
|
"author": "Sebastian Di Luzio <sebastian@diluz.io> (https://diluz.io)",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "16.11.12",
|
|
||||||
"typescript": "4.5.2"
|
"typescript": "4.5.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,6 @@
|
||||||
"module": "es2015",
|
"module": "es2015",
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"target": "es2015"
|
"target": "es2015"
|
||||||
}
|
},
|
||||||
|
"include": ["../apps/**/*", "./**/*"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,160 +1,183 @@
|
||||||
// TODO all of these globals (copied from eslintrc need to be typed at some point)
|
// TODO all of these globals (copied from eslintrc need to be typed at some point)
|
||||||
/* "globals": {
|
/* {
|
||||||
// Methods and Fields at https://banglejs.com/reference
|
// Methods and Fields at https://banglejs.com/reference
|
||||||
"BluetoothDevice": "readonly",
|
"Array": "readonly",
|
||||||
"BluetoothRemoteGATTCharacteristic": "readonly",
|
"ArrayBuffer": "readonly",
|
||||||
"BluetoothRemoteGATTServer": "readonly",
|
"ArrayBufferView": "readonly",
|
||||||
"BluetoothRemoteGATTService": "readonly",
|
"Bangle": "readonly",
|
||||||
"DataView": "readonly",
|
"BluetoothDevice": "readonly",
|
||||||
"E": "readonly",
|
"BluetoothRemoteGATTCharacteristic": "readonly",
|
||||||
"Error": "readonly",
|
"BluetoothRemoteGATTServer": "readonly",
|
||||||
"Flash": "readonly",
|
"BluetoothRemoteGATTService": "readonly",
|
||||||
"fs": "readonly",
|
"Boolean": "readonly",
|
||||||
"Function": "readonly",
|
"console": "readonly",
|
||||||
"heatshrink": "readonly",
|
"DataView": "readonly",
|
||||||
"I2C": "readonly",
|
"Date": "readonly",
|
||||||
"InternalError": "readonly",
|
"E": "readonly",
|
||||||
"Math": "readonly",
|
"Error": "readonly",
|
||||||
"Modules": "readonly",
|
"Flash": "readonly",
|
||||||
"NRF": "readonly",
|
"Float32Array": "readonly",
|
||||||
"Number": "readonly",
|
"Float64Array": "readonly",
|
||||||
"Object": "readonly",
|
"fs": "readonly",
|
||||||
"OneWire": "readonly",
|
"Function": "readonly",
|
||||||
"Pin": "readonly",
|
"Graphics": "readonly", // partly done
|
||||||
"process": "readonly",
|
"heatshrink": "readonly",
|
||||||
"Promise": "readonly",
|
"I2C": "readonly",
|
||||||
"ReferenceError": "readonly",
|
"Int16Array": "readonly",
|
||||||
"RegExp": "readonly",
|
"Int32Array": "readonly",
|
||||||
"Serial": "readonly",
|
"Int8Array": "readonly",
|
||||||
"SPI": "readonly",
|
"InternalError": "readonly",
|
||||||
"Storage": "readonly",
|
"JSON": "readonly",
|
||||||
"StorageFile": "readonly",
|
"Math": "readonly",
|
||||||
"String": "readonly",
|
"Modules": "readonly",
|
||||||
"SyntaxError": "readonly",
|
"NRF": "readonly",
|
||||||
"tensorflow": "readonly",
|
"Number": "readonly",
|
||||||
"TFMicroInterpreter": "readonly",
|
"Object": "readonly",
|
||||||
"TypeError": "readonly",
|
"OneWire": "readonly",
|
||||||
"Uint16Array": "readonly",
|
"Pin": "readonly",
|
||||||
"Uint24Array": "readonly",
|
"process": "readonly",
|
||||||
"Uint32Array": "readonly",
|
"Promise": "readonly",
|
||||||
"Uint8Array": "readonly",
|
"ReferenceError": "readonly",
|
||||||
"Uint8ClampedArray": "readonly",
|
"RegExp": "readonly",
|
||||||
"Waveform": "readonly",
|
"Serial": "readonly",
|
||||||
// Methods and Fields at https://banglejs.com/reference
|
"SPI": "readonly",
|
||||||
"analogRead": "readonly",
|
"Storage": "readonly",
|
||||||
"analogWrite": "readonly",
|
"StorageFile": "readonly",
|
||||||
"arguments": "readonly",
|
"String": "readonly",
|
||||||
"atob": "readonly",
|
"SyntaxError": "readonly",
|
||||||
"Bluetooth": "readonly",
|
"tensorflow": "readonly",
|
||||||
"BTN": "readonly",
|
"TFMicroInterpreter": "readonly",
|
||||||
"BTN1": "readonly",
|
"TypeError": "readonly",
|
||||||
"BTN2": "readonly",
|
"Uint16Array": "readonly",
|
||||||
"BTN3": "readonly",
|
"Uint24Array": "readonly",
|
||||||
"BTN4": "readonly",
|
"Uint32Array": "readonly",
|
||||||
"BTN5": "readonly",
|
"Uint8Array": "readonly",
|
||||||
"btoa": "readonly",
|
"Uint8ClampedArray": "readonly",
|
||||||
"changeInterval": "readonly",
|
"Waveform": "readonly",
|
||||||
"clearInterval": "readonly",
|
// Methods and Fields at https://banglejs.com/reference
|
||||||
"clearTimeout": "readonly",
|
"analogRead": "readonly",
|
||||||
"clearWatch": "readonly",
|
"analogWrite": "readonly",
|
||||||
"decodeURIComponent": "readonly",
|
"arguments": "readonly",
|
||||||
"digitalPulse": "readonly",
|
"atob": "readonly",
|
||||||
"digitalRead": "readonly",
|
"Bluetooth": "readonly",
|
||||||
"digitalWrite": "readonly",
|
"BTN": "readonly",
|
||||||
"dump": "readonly",
|
"BTN1": "readonly",
|
||||||
"echo": "readonly",
|
"BTN2": "readonly",
|
||||||
"edit": "readonly",
|
"BTN3": "readonly",
|
||||||
"encodeURIComponent": "readonly",
|
"BTN4": "readonly",
|
||||||
"eval": "readonly",
|
"BTN5": "readonly",
|
||||||
"getPinMode": "readonly",
|
"btoa": "readonly",
|
||||||
"getSerial": "readonly",
|
"changeInterval": "readonly",
|
||||||
"getTime": "readonly",
|
"clearInterval": "readonly",
|
||||||
"global": "readonly",
|
"clearTimeout": "readonly",
|
||||||
"HIGH": "readonly",
|
"clearWatch": "readonly",
|
||||||
"I2C1": "readonly",
|
"decodeURIComponent": "readonly",
|
||||||
"Infinity": "readonly",
|
"digitalPulse": "readonly",
|
||||||
"isFinite": "readonly",
|
"digitalRead": "readonly",
|
||||||
"isNaN": "readonly",
|
"digitalWrite": "readonly",
|
||||||
"LED": "readonly",
|
"dump": "readonly",
|
||||||
"LED1": "readonly",
|
"echo": "readonly",
|
||||||
"LED2": "readonly",
|
"edit": "readonly",
|
||||||
"load": "readonly",
|
"encodeURIComponent": "readonly",
|
||||||
"LoopbackA": "readonly",
|
"eval": "readonly",
|
||||||
"LoopbackB": "readonly",
|
"getPinMode": "readonly",
|
||||||
"LOW": "readonly",
|
"getSerial": "readonly",
|
||||||
"NaN": "readonly",
|
"getTime": "readonly",
|
||||||
"parseFloat": "readonly",
|
"global": "readonly",
|
||||||
"parseInt": "readonly",
|
"HIGH": "readonly",
|
||||||
"peek16": "readonly",
|
"I2C1": "readonly",
|
||||||
"peek32": "readonly",
|
"Infinity": "readonly",
|
||||||
"peek8": "readonly",
|
"isFinite": "readonly",
|
||||||
"pinMode": "readonly",
|
"isNaN": "readonly",
|
||||||
"poke16": "readonly",
|
"LED": "readonly",
|
||||||
"poke32": "readonly",
|
"LED1": "readonly",
|
||||||
"poke8": "readonly",
|
"LED2": "readonly",
|
||||||
"print": "readonly",
|
"load": "readonly",
|
||||||
"require": "readonly",
|
"LoopbackA": "readonly",
|
||||||
"reset": "readonly",
|
"LoopbackB": "readonly",
|
||||||
"save": "readonly",
|
"LOW": "readonly",
|
||||||
"Serial1": "readonly",
|
"NaN": "readonly",
|
||||||
"setBusyIndicator": "readonly",
|
"parseFloat": "readonly",
|
||||||
"setInterval": "readonly",
|
"parseInt": "readonly",
|
||||||
"setSleepIndicator": "readonly",
|
"peek16": "readonly",
|
||||||
"setTime": "readonly",
|
"peek32": "readonly",
|
||||||
"setTimeout": "readonly",
|
"peek8": "readonly",
|
||||||
"setWatch": "readonly",
|
"pinMode": "readonly",
|
||||||
"shiftOut": "readonly",
|
"poke16": "readonly",
|
||||||
"SPI1": "readonly",
|
"poke32": "readonly",
|
||||||
"Terminal": "readonly",
|
"poke8": "readonly",
|
||||||
"trace": "readonly",
|
"print": "readonly",
|
||||||
"VIBRATE": "readonly",
|
"require": "readonly",
|
||||||
|
"reset": "readonly",
|
||||||
|
"save": "readonly",
|
||||||
|
"Serial1": "readonly",
|
||||||
|
"setBusyIndicator": "readonly",
|
||||||
|
"setInterval": "readonly",
|
||||||
|
"setSleepIndicator": "readonly",
|
||||||
|
"setTime": "readonly",
|
||||||
|
"setTimeout": "readonly",
|
||||||
|
"setWatch": "readonly",
|
||||||
|
"shiftOut": "readonly",
|
||||||
|
"SPI1": "readonly",
|
||||||
|
"Terminal": "readonly",
|
||||||
|
"trace": "readonly",
|
||||||
|
"VIBRATE": "readonly",
|
||||||
|
// Aliases and not defined at https://banglejs.com/reference
|
||||||
|
"g": "readonly", // done
|
||||||
|
"WIDGETS": "readonly" // done
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type loadGlobals = {};
|
// ambient JS definitions
|
||||||
|
|
||||||
declare global {
|
declare const require: ((module: 'heatshrink') => {
|
||||||
const Bangle: {
|
decompress: (compressedString: string) => string;
|
||||||
// functions
|
}) & // TODO add more
|
||||||
buzz: () => void;
|
((module: 'otherString') => {});
|
||||||
drawWidgets: () => void;
|
|
||||||
isCharging: () => boolean;
|
|
||||||
// events
|
|
||||||
on(event: 'charging', listener: (charging: boolean) => void): void;
|
|
||||||
// TODO add more
|
|
||||||
};
|
|
||||||
|
|
||||||
type Image = {
|
// ambient bangle.js definitions
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
bpp?: number;
|
|
||||||
buffer: ArrayBuffer | string;
|
|
||||||
transparent?: number;
|
|
||||||
palette?: Uint16Array;
|
|
||||||
};
|
|
||||||
|
|
||||||
type GraphicsApi = {
|
declare const Bangle: {
|
||||||
reset: () => void;
|
// functions
|
||||||
flip: () => void;
|
buzz: () => void;
|
||||||
setColor: (color: string) => void; // TODO we can most likely type color more usefully than this
|
drawWidgets: () => void;
|
||||||
drawImage: (
|
isCharging: () => boolean;
|
||||||
image: string | Image | ArrayBuffer,
|
// events
|
||||||
xOffset: number,
|
on(event: 'charging', listener: (charging: boolean) => void): void;
|
||||||
yOffset: number,
|
// TODO add more
|
||||||
options?: {
|
};
|
||||||
rotate?: number;
|
|
||||||
scale?: number;
|
|
||||||
}
|
|
||||||
) => void;
|
|
||||||
// TODO add more
|
|
||||||
};
|
|
||||||
|
|
||||||
const Graphics: GraphicsApi;
|
declare type Image = {
|
||||||
const g: GraphicsApi;
|
width: number;
|
||||||
|
height: number;
|
||||||
|
bpp?: number;
|
||||||
|
buffer: ArrayBuffer | string;
|
||||||
|
transparent?: number;
|
||||||
|
palette?: Uint16Array;
|
||||||
|
};
|
||||||
|
|
||||||
type Widget = {
|
declare type GraphicsApi = {
|
||||||
area: 'tr' | 'tl';
|
reset: () => void;
|
||||||
width: number;
|
flip: () => void;
|
||||||
draw: () => void;
|
setColor: (color: string) => void; // TODO we can most likely type color more usefully than this
|
||||||
};
|
drawImage: (
|
||||||
const WIDGETS: { [key: string]: Widget };
|
image: string | Image | ArrayBuffer,
|
||||||
}
|
xOffset: number,
|
||||||
|
yOffset: number,
|
||||||
|
options?: {
|
||||||
|
rotate?: number;
|
||||||
|
scale?: number;
|
||||||
|
}
|
||||||
|
) => void;
|
||||||
|
// TODO add more
|
||||||
|
};
|
||||||
|
|
||||||
|
declare const Graphics: GraphicsApi;
|
||||||
|
declare const g: GraphicsApi;
|
||||||
|
|
||||||
|
declare type Widget = {
|
||||||
|
area: 'tr' | 'tl';
|
||||||
|
width: number;
|
||||||
|
draw: () => void;
|
||||||
|
};
|
||||||
|
declare const WIDGETS: { [key: string]: Widget };
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue