Default enum arguments not supported yet

This commit is contained in:
Michal Moskal 2016-04-12 17:57:16 -07:00
parent e63b764568
commit 26985f2813

View File

@ -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;