mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
Move IR definitions into root of Johnny Five since they were deprecated. (#23236)
* Update J5 to deprecate IR methods that now live in their own exports * Add Credits
This commit is contained in:
committed by
Sheetal Nandi
parent
3f53615e9e
commit
c62adce5d1
55
types/johnny-five/index.d.ts
vendored
55
types/johnny-five/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/rwaldron/johnny-five
|
||||
// Definitions by: Toshiya Nakakura <https://github.com/nakakura>
|
||||
// Zoltan Ujvary <https://github.com/ujvzolee>
|
||||
// Simon Colmer <https://github.com/workshop2>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference types="node"/>
|
||||
@@ -290,30 +291,6 @@ export declare class IMU {
|
||||
}
|
||||
|
||||
export declare module IR {
|
||||
export interface MotionOption {
|
||||
pin: number | string;
|
||||
}
|
||||
|
||||
export class Motion {
|
||||
constructor(option: number | MotionOption);
|
||||
on(event: string, cb: () => void): this;
|
||||
on(event: "data", cb: (data: any) => void): this;
|
||||
on(event: "motionstart", cb: () => void): this;
|
||||
on(event: "motionend", cb: () => void): this;
|
||||
on(event: "calibrated", cb: () => void): this;
|
||||
}
|
||||
|
||||
export interface PloximityOption {
|
||||
pin: number | string;
|
||||
controller: string;
|
||||
}
|
||||
|
||||
export class Proximity {
|
||||
constructor(option: number | PloximityOption);
|
||||
on(event: string, cb: () => void): this;
|
||||
on(event: "data", cb: (data: any) => void): this;
|
||||
on(event: "change", cb: () => void): this;
|
||||
}
|
||||
|
||||
export interface ArrayOption {
|
||||
pins: Array<number> | Array<string>;
|
||||
@@ -521,6 +498,19 @@ export declare module Led {
|
||||
}
|
||||
}
|
||||
|
||||
export interface MotionOption {
|
||||
pin: number | string;
|
||||
}
|
||||
|
||||
export class Motion {
|
||||
constructor(option: number | MotionOption);
|
||||
on(event: string, cb: () => void): this;
|
||||
on(event: "data", cb: (data: any) => void): this;
|
||||
on(event: "motionstart", cb: () => void): this;
|
||||
on(event: "motionend", cb: () => void): this;
|
||||
on(event: "calibrated", cb: () => void): this;
|
||||
}
|
||||
|
||||
export interface MotorOption {
|
||||
pins: any;
|
||||
current?: any;
|
||||
@@ -629,6 +619,23 @@ export declare class Ping {
|
||||
constructor(option: number | PingOption);
|
||||
}
|
||||
|
||||
export declare interface ProximityOption {
|
||||
pin: number | string;
|
||||
controller: string;
|
||||
}
|
||||
|
||||
export declare interface ProximityData {
|
||||
cm: number;
|
||||
in: number;
|
||||
}
|
||||
|
||||
export declare class Proximity {
|
||||
constructor(option: number | ProximityOption);
|
||||
on(event: string, cb: () => void): this;
|
||||
on(event: "data", cb: (data: ProximityData) => void): this;
|
||||
on(event: "change", cb: () => void): this;
|
||||
}
|
||||
|
||||
export interface RelayOption {
|
||||
pin: number | string;
|
||||
type?: string;
|
||||
|
||||
@@ -71,14 +71,14 @@ board.on('ready', function(){
|
||||
freq: 100 // optional
|
||||
});
|
||||
|
||||
var motion = new five.IR.Motion(7);
|
||||
var motion = new five.Motion(7);
|
||||
|
||||
// Options object with pin property
|
||||
var motion = new five.IR.Motion({
|
||||
var motion = new five.Motion({
|
||||
pin: 7
|
||||
});
|
||||
|
||||
var proximity = new five.IR.Proximity({
|
||||
var proximity = new five.Proximity({
|
||||
controller: "GP2Y0A21YK",
|
||||
pin: "A0"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user