Removed setupAutoReset

This commit is contained in:
thepaperpilot 2022-03-11 09:22:16 -06:00
parent e5da55d26a
commit bb2c61e425

View file

@ -12,7 +12,7 @@ import Decimal from "lib/break_eternity";
import { Computable, GetComputableType, processComputable } from "util/computed";
import { createLazyProxy } from "util/proxies";
import { Unsubscribe } from "nanoevents";
import { computed, isRef, unref } from "vue";
import { isRef, unref } from "vue";
export const ResetType = Symbol("Reset");
@ -69,19 +69,6 @@ export function createReset<T extends ResetOptions>(
});
}
export function setupAutoReset(
layer: GenericLayer,
reset: GenericReset,
autoActive: Computable<boolean> = true
): Unsubscribe {
const isActive = typeof autoActive === "function" ? computed(autoActive) : autoActive;
return layer.on("update", () => {
if (unref(isActive)) {
reset.reset();
}
});
}
const listeners: Record<string, Unsubscribe | undefined> = {};
export function trackResetTime(layer: GenericLayer, reset: GenericReset): PersistentRef<Decimal> {
const resetTime = persistent<Decimal>(new Decimal(0));