[gnome-sound-recorder] keep variables in function only scope
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder] keep variables in function only scope
- Date: Sat, 6 Jun 2020 07:05:01 +0000 (UTC)
commit 577e8a19527e1adfb2e376a94501d4cdb8e87423
Author: Kavan Mevada <kavanmevada gmail com>
Date: Sat Jun 6 11:43:55 2020 +0530
keep variables in function only scope
src/recorder.js | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/recorder.js b/src/recorder.js
index 23c09e1..ae5b2d2 100644
--- a/src/recorder.js
+++ b/src/recorder.js
@@ -176,25 +176,26 @@ var Recorder = new GObject.registerClass({
if (val > 0)
val = 0;
- this.peak = Math.pow(10, val / 20);
+ const peak = Math.pow(10, val / 20);
if (this.clock === null)
this.clock = this.pipeline.get_clock();
+ let absoluteTime;
try {
- this.absoluteTime = this.clock.get_time();
+ absoluteTime = this.clock.get_time();
} catch (error) {
- this.absoluteTime = 0;
+ absoluteTime = 0;
}
if (this.baseTime === 0)
- this.baseTime = this.absoluteTime;
+ this.baseTime = absoluteTime;
- this.runTime = this.absoluteTime - this.baseTime;
- let approxTime = Math.round(this.runTime / 100000000);
- this.emit('waveform', approxTime, this.peak);
+ const runTime = absoluteTime - this.baseTime;
+ let approxTime = Math.round(runTime / 100000000);
+ this.emit('waveform', approxTime, peak);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]