pxt-calliope/libs/microbit/mbit.ts

29 lines
638 B
TypeScript
Raw Normal View History

2016-03-10 23:01:04 +01:00
type Action = () => void;
namespace helpers {
export function arraySplice<T>(arr: T[], start: number, len: number) {
if (start < 0) {
return;
}
for (let i = 0; i < len; ++i) {
arr.removeAt(start)
}
}
}
namespace console {
export function log(msg: string) {
writeString(msg);
writeString("\r\n");
}
//% shim=micro_bit::serialSendString
function writeString(text: string): void { }
}
namespace math {
export function clamp(min: number, max:number, value:number): number {
return Math.min(max, Math.max(min, value));
}
}