From 31f91d4e244bddb247ee7543570ad6227ff1bb05 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Wed, 28 Mar 2018 09:04:49 -0700 Subject: [PATCH] upgrading to latest common packages (#383) --- libs/base/pxt.json | 1 + libs/base/shims.d.ts | 10 +++------- libs/screen/shims.d.ts | 8 ++++---- libs/screen/targetoverrides.ts | 9 ++++----- package.json | 2 +- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/libs/base/pxt.json b/libs/base/pxt.json index a75eb374..a6424b46 100644 --- a/libs/base/pxt.json +++ b/libs/base/pxt.json @@ -16,6 +16,7 @@ "ns.ts", "control.cpp", "control.ts", + "eventcontext.ts", "serial.cpp", "serial.ts", "fieldeditors.ts" diff --git a/libs/base/shims.d.ts b/libs/base/shims.d.ts index 913d5e7f..81d0b49b 100644 --- a/libs/base/shims.d.ts +++ b/libs/base/shims.d.ts @@ -102,14 +102,10 @@ declare namespace control { function millis(): int32; /** - * Run code when a registered event happens. - * @param id the event compoent id - * @param value the event value to match + * Used internally */ - //% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src|with value %value" - //% blockExternalInputs=1 - //% help="control/on-event" flags.defl=16 shim=control::onEvent - function onEvent(src: int32, value: int32, handler: () => void, flags?: int32): void; + //% flags.defl=16 shim=control::internalOnEvent + function internalOnEvent(src: int32, value: int32, handler: () => void, flags?: int32): void; /** * Reset the device. diff --git a/libs/screen/shims.d.ts b/libs/screen/shims.d.ts index 8033f4a4..0649bca4 100644 --- a/libs/screen/shims.d.ts +++ b/libs/screen/shims.d.ts @@ -23,14 +23,14 @@ declare interface Image { /** * Set pixel color */ - //% shim=ImageMethods::set - set(x: int32, y: int32, c: int32): void; + //% shim=ImageMethods::setPixel + setPixel(x: int32, y: int32, c: int32): void; /** * Get a pixel color */ - //% shim=ImageMethods::get - get(x: int32, y: int32): int32; + //% shim=ImageMethods::getPixel + getPixel(x: int32, y: int32): int32; /** * Fill entire image with a given color diff --git a/libs/screen/targetoverrides.ts b/libs/screen/targetoverrides.ts index 62dbd39e..01261443 100644 --- a/libs/screen/targetoverrides.ts +++ b/libs/screen/targetoverrides.ts @@ -5,7 +5,7 @@ //% groups=["0.,","1#*"] function img(lits: any, ...args: any[]): Image { return null } -let screen = image.create(DAL.LCD_WIDTH, DAL.LCD_HEIGHT) +const screen = image.create(DAL.LCD_WIDTH, DAL.LCD_HEIGHT) namespace _screen_internal { //% shim=pxt::updateScreen @@ -13,10 +13,9 @@ namespace _screen_internal { //% shim=pxt::updateStats function updateStats(msg: string): void { } - control.setupScreenRefresh(() => updateScreen(screen)) - - export function _stats(msg: string) { - updateStats(msg) + control.__screen.setupUpdate(() => updateScreen(screen)) + control.EventContext.onStats = function(msg: string) { + updateStats(msg); } } diff --git a/package.json b/package.json index bd0b04c2..4ee9489b 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "webfonts-generator": "^0.4.0" }, "dependencies": { - "pxt-common-packages": "0.20.14", + "pxt-common-packages": "0.20.28", "pxt-core": "3.5.11" }, "scripts": {