From 0d173293149af27c42b6570ed7cb5eb0156669e1 Mon Sep 17 00:00:00 2001 From: Jurand Niemczycki <32194442+createdbyjurand@users.noreply.github.com> Date: Wed, 25 Jul 2018 18:02:36 +0200 Subject: [PATCH] espruino: added type for wifi module for access point (#27544) * espruino added type for wifi module for access point * espruino added myself to definitions * changed tabsize to 4 --- types/espruino/espruino-tests.ts | 12 ++++++++++++ types/espruino/index.d.ts | 10 ++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/types/espruino/espruino-tests.ts b/types/espruino/espruino-tests.ts index 5e84a93e65..32f044796d 100644 --- a/types/espruino/espruino-tests.ts +++ b/types/espruino/espruino-tests.ts @@ -1,2 +1,14 @@ +import * as wifi from 'Wifi'; + +wifi.connect('ssid', { password: 'pass', authMode: 'wpa_wpa2' }, err => { + if (err) throw err; + console.log('connected'); +}); + +wifi.startAP('ssid', { password: 'pass', authMode: 'wpa_wpa2' }, err => { + if (err) throw err; + console.log("created"); +}); + I2C1.setup({ scl: D4, sda: D0 }); Serial2.setup(9600, { rx: D16, tx: D17 }); diff --git a/types/espruino/index.d.ts b/types/espruino/index.d.ts index 43d1068230..61cf72f173 100644 --- a/types/espruino/index.d.ts +++ b/types/espruino/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Espruino 1.94 // Project: http://www.espruino.com/ // Definitions by: Stanislav Berkov +// Jurand Niemczycki // Definitions: https://github.com/borisyankov/DefinitelyTyped declare interface Object { @@ -9,6 +10,7 @@ declare interface Object { declare module "Wifi" { function connect(ssid: string, options: any, callback: (err: any) => any): any; + function startAP(ssid: string, options: any, callback: (err: any) => any): any; } declare module "InfluxDB" { @@ -391,10 +393,10 @@ declare interface Timer { } - // write(data: any[]): any; - // on(event: string, handler: (data: any) => any): any; - // setup(boudrate: number, options: any): any; - // read(chars?: number): string; +// write(data: any[]): any; +// on(event: string, handler: (data: any) => any): any; +// setup(boudrate: number, options: any): any; +// read(chars?: number): string; /**