Map and clean deprecated functions (#175)

* add image and deprecated arrow functions

* update locales

* map basic.showArrow

* map arrow blocks

* map & remove arrow images

* remove arrow blocks

* update locales

* remove & patch:
rgbw -> rgb
button/pin pressed -> button/pin event
loudness -> soundLevel

* update ts mappings for arrows

* add wip ts patch rules

* update .blocks files

* use Click instead of Down as default in Documentation and tests

* patch test.blocks

* fix lowercase name tag

* update test.blocks

* update blocks test files

* update blocks test files

* format block files

* pass blocks file tests

* fix ts mapping

* fix color.defl value

closes https://github.com/microsoft/pxt-calliope/issues/136

* fix ts mappings

- add optional spacing at the end of rgbw()
- map up to v4.0.19

* add suggested changes

* replace innerText by textContent

Co-authored-by: JW <gitkraken@juriwolf.de>
Co-authored-by: Juri <info@juriwolf.de>
This commit is contained in:
Juri Wolf
2022-04-26 19:28:42 +02:00
committed by GitHub
parent 3b9d90e551
commit a93febb5b7
102 changed files with 1458 additions and 740 deletions

View File

@ -38,7 +38,7 @@ Each time the crocodile clip is firmly connected and disconnected from pin `P0`,
the @boardname@ will return a random Number between 0 and the parameter limit.
```blocks
input.onPinPressed(TouchPin.P0, () => {
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
basic.showNumber(randint(0, 10))
})
```

View File

@ -63,7 +63,7 @@ for (let i = 0; i < values.length; i++) {
The ``||led:plot bar graph||`` also sends the number value it's plotting to the console. You can see the output in the Data Viewer. It charts the values and they appear as individual numbers in console.
```blocks
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
for (let i = 0; i < 25; i++) {
if (i % 2 > 0) {
led.plotBarGraph(0, 0)

View File

@ -51,7 +51,7 @@ The first job of the scheduler is to allow multiple *subprograms* to be queued u
```typescript
let count = 0
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
count++;
})
@ -74,7 +74,7 @@ The second statement informs the scheduler that on each and every event of the *
// statement 1
let count = 0
// statement 2
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
count++;
})
```
@ -85,7 +85,7 @@ The third statement queues a `forever` loop for later execution by the scheduler
// statement 1
let count = 0
// statement 2
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
count++;
})
// statement 3
@ -157,7 +157,7 @@ As a result, you can easily add a new capability to the micro:bit by just adding
```typescript
let count = 0
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
count = count + 1
})
@ -165,7 +165,7 @@ basic.forever(() => {
basic.showNumber(count)
})
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
count = 0
})
```

View File

@ -6,7 +6,7 @@ The code below shows a simple script that sends a line when the BBC micro:bit st
```blocks
serial.writeLine("started...")
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
serial.writeLine("A pressed")
})
```

View File

@ -4,19 +4,19 @@ The JavaScript simulator allows you to test and execute most BBC micro:bit progr
It allows you to emulate sensor data or user interactions.
```sim
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
basic.showString("A");
});
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
basic.showString("B");
});
input.onPinPressed(TouchPin.P0, () => {
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Click, () => {
basic.showString("0");
});
input.onPinPressed(TouchPin.P1, () => {
input.onPinTouchEvent(TouchPin.P1, ButtonEvent.Click, () => {
basic.showString("1");
});
input.onPinPressed(TouchPin.P2, () => {
input.onPinTouchEvent(TouchPin.P2, ButtonEvent.Click, () => {
basic.showString("2");
});
input.temperature()