diff options
author | Amine El Baghdadi <75886237+NoobJsPerson@users.noreply.github.com> | 2021-05-15 18:12:56 +0000 |
---|---|---|
committer | Amine El Baghdadi <75886237+NoobJsPerson@users.noreply.github.com> | 2021-05-15 18:12:56 +0000 |
commit | ef7b821d2a5143db9c0660cffc1189cf6e63dc29 (patch) | |
tree | 1d1108057e69d11a8eaa13442c135f9e62271838 | |
parent | 99f7ceddcd2ce99a8e2439b3a04e5a3ba236c64a (diff) |
update main.js
-rw-r--r-- | main.js | 44 |
1 files changed, 20 insertions, 24 deletions
@@ -1,3 +1,5 @@ +/* Import the interpolate function*/ +import interpolate from "interpolate.js"; /* Compute the total duration of the run. */ function compute() { @@ -51,30 +53,24 @@ function generate_mod_message( const one_prec_millis = milliseconds.toFixed(1).replace("0.", ""); const two_prec_millis = milliseconds.toFixed(2).replace("0.", ""); const three_prec_millis = milliseconds.toFixed(3).replace("0.", ""); - - mod_message = mod_message.replaceAll("${FPS}", fps) - .replaceAll("${H}", hours) - .replaceAll("${M}", minutes) - .replaceAll("${S}", seconds) - .replaceAll("${MS}", milliseconds) - - .replaceAll("${PM}", padded_minutes) - .replaceAll("${PS}", padded_seconds) - - .replaceAll("${1MS}", one_prec_millis) - .replaceAll("${2MS}", two_prec_millis) - .replaceAll("${3MS}", three_prec_millis) - - .replaceAll("${TS}", total_seconds) - - .replaceAll("${ST}", start_time) - .replaceAll("${ET}", end_time) - .replaceAll("${TT}", total_time) - - .replaceAll("${SF}", start_frame) - .replaceAll("${EF}", end_frame) - .replaceAll("${TF}", total_frames) - + const params = { + H: hours, + M: minutes, + S: seconds, + MS: milliseconds, + PM: padded_minutes, + PS: padded_seconds, + "1MS": one_prec_millis, + "2MS": two_prec_millis, + "3MS": three_prec_millis, + ST: start_time, + ET: end_time, + TT: total_time, + SF: start_frame, + EF: end_frame, + TF: total_frames + }; + mod_message = interpolate (mod_message,params); return mod_message; } |