diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-04-18 22:45:54 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-04-18 22:45:54 +0800 |
commit | c87c6f2703d689375518f54905ae10e2edb42d41 (patch) | |
tree | 1686e97b83bf78f658aece231e7fde6f6f060105 /featureClass/featureManager.js | |
parent | 082d9cf4af63495a3d8709b0ee87dc935ed986dc (diff) | |
download | SoopyV2-c87c6f2703d689375518f54905ae10e2edb42d41.tar.gz SoopyV2-c87c6f2703d689375518f54905ae10e2edb42d41.tar.bz2 SoopyV2-c87c6f2703d689375518f54905ae10e2edb42d41.zip |
asd
Diffstat (limited to 'featureClass/featureManager.js')
-rw-r--r-- | featureClass/featureManager.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js index 78e06dd..982c106 100644 --- a/featureClass/featureManager.js +++ b/featureClass/featureManager.js @@ -291,14 +291,14 @@ class FeatureManager { try { for (Event of Object.values(this.events[event])) { if (Event.context.enabled) { - this.startRecordingPerformance(Event.context.constructor.name, event) + if (this.recordingPerformanceUsage) this.startRecordingPerformance(Event.context.constructor.name, event) let start = Date.now() Event.func.call(Event.context, ...args) let time = Date.now() - start if (time > this.longEventTime) { logger.logMessage("Long event triggered [" + time + "ms] (" + Event.context.constructor.name + "/" + event + ")", 3) } - this.stopRecordingPerformance(Event.context.constructor.name, event) + if (this.recordingPerformanceUsage) this.stopRecordingPerformance(Event.context.constructor.name, event) } } } catch (e) { @@ -313,14 +313,14 @@ class FeatureManager { try { for (Event of Object.values(this.soopyEventHandlers[event])) { if (Event.context.enabled) { - this.startRecordingPerformance(Event.context.constructor.name, event) + if (this.recordingPerformanceUsage) this.startRecordingPerformance(Event.context.constructor.name, event) let start = Date.now() Event.func.call(Event.context, ...args) let time = Date.now() - start if (time > this.longEventTime) { logger.logMessage("Long event triggered [" + time + "ms] (" + Event.context.constructor.name + "/" + event + ")", 3) } - this.stopRecordingPerformance(Event.context.constructor.name, event) + if (this.recordingPerformanceUsage) this.stopRecordingPerformance(Event.context.constructor.name, event) } } } catch (e) { @@ -412,14 +412,14 @@ class FeatureManager { trigger: register(type, (...args) => { try { if (context.enabled) { - this.startRecordingPerformance(context.constructor.name, type) + if (this.recordingPerformanceUsage) this.startRecordingPerformance(context.constructor.name, type) let start = Date.now() func.call(context, ...(args || [])) let time = Date.now() - start if (time > this.longEventTime) { logger.logMessage("Long event triggered [" + time + "ms] (" + context.constructor.name + "/" + type + ")", 3) } - this.stopRecordingPerformance(context.constructor.name, type) + if (this.recordingPerformanceUsage) this.stopRecordingPerformance(context.constructor.name, type) } } catch (e) { logger.logMessage("Error in " + type + " event: " + JSON.stringify(e, undefined, 2), 2) @@ -442,14 +442,14 @@ class FeatureManager { trigger: registerForgeBase(event, (...args) => { try { if (context.enabled) { - this.startRecordingPerformance(context.constructor.name, event.class.name) + if (this.recordingPerformanceUsage) this.startRecordingPerformance(context.constructor.name, event.class.name) let start = Date.now() func.call(context, ...(args || [])) let time = Date.now() - start if (time > this.longEventTime) { logger.logMessage("Long (forge) event triggered (" + context.constructor.name + "/" + event.class.toString() + ")", 3) } - this.stopRecordingPerformance(context.constructor.name, event.class.name) + if (this.recordingPerformanceUsage) this.stopRecordingPerformance(context.constructor.name, event.class.name) } } catch (e) { logger.logMessage("Error in " + event.class.toString() + " (forge) event: " + JSON.stringify(e, undefined, 2), 2) |