Removed setupAutoReset
This commit is contained in:
parent
e5da55d26a
commit
bb2c61e425
1 changed files with 1 additions and 14 deletions
|
@ -12,7 +12,7 @@ import Decimal from "lib/break_eternity";
|
||||||
import { Computable, GetComputableType, processComputable } from "util/computed";
|
import { Computable, GetComputableType, processComputable } from "util/computed";
|
||||||
import { createLazyProxy } from "util/proxies";
|
import { createLazyProxy } from "util/proxies";
|
||||||
import { Unsubscribe } from "nanoevents";
|
import { Unsubscribe } from "nanoevents";
|
||||||
import { computed, isRef, unref } from "vue";
|
import { isRef, unref } from "vue";
|
||||||
|
|
||||||
export const ResetType = Symbol("Reset");
|
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> = {};
|
const listeners: Record<string, Unsubscribe | undefined> = {};
|
||||||
export function trackResetTime(layer: GenericLayer, reset: GenericReset): PersistentRef<Decimal> {
|
export function trackResetTime(layer: GenericLayer, reset: GenericReset): PersistentRef<Decimal> {
|
||||||
const resetTime = persistent<Decimal>(new Decimal(0));
|
const resetTime = persistent<Decimal>(new Decimal(0));
|
||||||
|
|
Loading…
Reference in a new issue