From 9ef57152e46b33016586aeb4ec533d4412751510 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 27 Mar 2022 23:42:47 +0200 Subject: [PATCH] add duration getter --- packages/core/strudel.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/strudel.mjs b/packages/core/strudel.mjs index 76a1d454..b94c8d72 100644 --- a/packages/core/strudel.mjs +++ b/packages/core/strudel.mjs @@ -138,6 +138,10 @@ class Hap { } } + get duration() { + return this.whole.end.sub(this.whole.begin).valueOf(); + } + withSpan(func) { // Returns a new event with the function f applies to the event timespan. const whole = this.whole ? func(this.whole) : undefined @@ -1034,7 +1038,6 @@ Pattern.prototype.bootstrap = function() { } return [functionName, curry(composable, makeComposable)]; })); - // note: this === Pattern.prototypetgh6z this.patternified.forEach((prop) => { // the following will patternify all functions in Pattern.prototype.patternified