adding waitUntil to buttons

This commit is contained in:
Peli de Halleux
2017-11-30 10:05:00 -08:00
parent 305a650125
commit a92edcffee
6 changed files with 34 additions and 0 deletions

View File

@ -127,6 +127,20 @@ namespace brick {
onEvent(ev: ButtonEvent, body: () => void) {
control.onEvent(this._id, ev, body)
}
/**
* Waits until the event is raised
* @param ev the event to wait for
*/
//% help=input/button/wait-until
//% blockId=buttonWaitUntil block="wait until `icons.brickButtons` %button|%event"
//% parts="brick"
//% blockNamespace=brick
//% weight=98 blockGap=8
//% group="Buttons"
waitUntil(ev: ButtonEvent) {
control.waitForEvent(this._id, ev);
}
}
}