Default enum arguments not supported yet
This commit is contained in:
parent
e63b764568
commit
26985f2813
|
@ -134,8 +134,9 @@ namespace music {
|
||||||
*/
|
*/
|
||||||
//% help=music/beat weight=49
|
//% help=music/beat weight=49
|
||||||
//% blockId=device_beat block="%fraction|beat"
|
//% blockId=device_beat block="%fraction|beat"
|
||||||
export function beat(fraction : BeatFraction = BeatFraction.Whole): number {
|
export function beat(fraction?: BeatFraction): number {
|
||||||
init();
|
init();
|
||||||
|
if (fraction == null) fraction = BeatFraction.Whole;
|
||||||
let beat = 60000 / beatsPerMinute;
|
let beat = 60000 / beatsPerMinute;
|
||||||
if (fraction == BeatFraction.Whole) return beat;
|
if (fraction == BeatFraction.Whole) return beat;
|
||||||
else if (fraction == BeatFraction.Half) return beat / 2;
|
else if (fraction == BeatFraction.Half) return beat / 2;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user