microvium
Version:
A compact, embeddable scripting engine for microcontrollers for executing small scripts written in a subset of JavaScript.
75 lines (74 loc) • 3.43 kB
TypeScript
import * as im from 'immutable';
import { Microvium } from '../lib';
export declare type Callback<T> = (v: T) => void;
export declare class MicroviumUsageError extends Error {
}
export declare class CompileError extends MicroviumUsageError {
}
export declare class MicroviumSyntaxError extends CompileError {
}
export declare class RuntimeError extends MicroviumUsageError {
}
export declare const never: never;
export declare const todoSymbol: unique symbol;
export declare type Todo = typeof todoSymbol;
export declare function throwError(message: string): never;
export declare function notImplemented(feature?: string): never;
export declare function handlerNotImplemented(): never;
export declare function assertUnreachable(value: never): never;
export declare function unexpected(message?: string): never;
export declare function reserved(message?: string): never;
export declare function hardAssert(predicate: any, message?: string): asserts predicate;
export declare function invalidOperation(message: string): never;
export declare function notUndefined<T>(v: T | undefined | null): T;
export declare function notNull<T>(v: T | null): T;
export declare function abstractFunctionCalled(name: string): never;
export declare function uniqueName(base: string, nameTaken: (name: string) => boolean): string;
export declare function uniqueNameInSet(base: string, set: Set<string>): string;
export declare function entries<V>(o: im.Set<V>): V[];
export declare function entries<K, V>(o: im.Map<K, V>): [K, V][];
export declare function entries<K, V>(o: Map<K, V>): [K, V][];
export declare function entries<T>(o: {
[s: string]: T;
}): [string, T][];
export declare function entries<T>(o: {
[s: number]: T;
}): [string, T][];
export declare function entriesInOrder<V>(o: im.Set<V>): V[];
export declare function entriesInOrder<K, V>(o: im.Map<K, V>): [K, V][];
export declare function entriesInOrder<K, V>(o: Map<K, V>): [K, V][];
export declare function entriesInOrder<T>(o: {
[s: string]: T;
}): [string, T][];
export declare function entriesInOrder<T>(o: {
[s: number]: T;
}): [string, T][];
export declare function mapObject<V1, V2>(obj: {
[s: string]: V1;
}, f: (v: V1, k: string) => V2): {
[s: string]: V2;
};
export declare function mapMap<K, V1, V2>(src: Map<K, V1>, f: (v: V1, k: K) => V2): Map<K, V2>;
export declare function fromEntries<V>(entries: [string, V][]): {
[k: string]: V;
};
export declare function todo(message: string): Todo;
export declare function stringifyIdentifier(key: string): string;
export declare function stringifyStringLiteral(s: string): string;
export declare function isNameString(NameOperand: string): boolean;
export declare function writeTextFile(filename: string, content: string): void;
/** An array of the given length with no holes in it */
export declare function arrayOfLength(len: number): undefined[];
export declare function importPodValueRecursive(vm: Microvium, value: any): any;
export declare function jsonParse(vm: Microvium): (text: string) => any;
/**
* A form of dynamic scoping
*/
export declare function defineContext<T>(): {
use<U>(value: T, scope: () => U): U;
readonly value: T;
};
export declare function mapEmplace<K, V>(map: Map<K, V>, key: K, handler: {
insert(key: K, map: Map<K, V>): V;
update?(existing: V, key: K, map: Map<K, V>): V;
}): V;