aboutsummaryrefslogtreecommitdiff
path: root/src/featureClass
diff options
context:
space:
mode:
Diffstat (limited to 'src/featureClass')
-rw-r--r--src/featureClass/class.js5
-rw-r--r--src/featureClass/featureManager.js11
2 files changed, 12 insertions, 4 deletions
diff --git a/src/featureClass/class.js b/src/featureClass/class.js
index 987b460..fc4f7ff 100644
--- a/src/featureClass/class.js
+++ b/src/featureClass/class.js
@@ -176,6 +176,8 @@ class Event {
this.registerArgs = registerArgs
this.parent = parent
+ this.data.eventT = this
+
this.enabled = true
this.when = undefined
@@ -280,14 +282,17 @@ class ForgeEvent extends Event {
}
class CustomEvent extends Event {
+ //theEvent, theEvent.trigger, [isFps, interval, func], this
constructor(...args) {
super(...args)
}
actuallyRegister() {
+ if (this.data.type === "step") return
this.trigger.register()
}
actuallyUnregister() {
+ if (this.data.type === "step") return
this.trigger.unregister()
}
}
diff --git a/src/featureClass/featureManager.js b/src/featureClass/featureManager.js
index 6974f46..eb2f0f9 100644
--- a/src/featureClass/featureManager.js
+++ b/src/featureClass/featureManager.js
@@ -19,7 +19,7 @@ let CTRequire = new JSLoader.CTRequire(StrongCachingModuleScriptProvider)
const System = Java.type("java.lang.System")
let loadedModules = new Set()
-let shouldRequireForceNoCache = true
+let shouldRequireForceNoCache = false
function RequireNoCache(place) {
if (!shouldRequireForceNoCache) {
@@ -566,10 +566,12 @@ class FeatureManager {
if (!func) throw new Error("Function must not be null")
this.customEvents[id] = {
- func: func,
- context: context,
+ func,
+ context,
trigger: register(type, (...args) => {
try {
+ if (this.customEvents[id]?.eventT && !this.customEvents[id].eventT.enabled) return
+
if (context.enabled) {
if (this.recordingPerformanceUsage) this.startRecordingPerformance(context.getId(), type)
let start = Date.now()
@@ -587,7 +589,8 @@ class FeatureManager {
soopyV2Server.reportError(e, "Error in " + type + " event.")
}
}),
- id: id
+ id,
+ type,
}
return this.customEvents[id]