diff --git a/indigo/indigo/src/main/scala/indigo/package.scala b/indigo/indigo/src/main/scala/indigo/package.scala index fedb609b4..60001bd10 100644 --- a/indigo/indigo/src/main/scala/indigo/package.scala +++ b/indigo/indigo/src/main/scala/indigo/package.scala @@ -159,6 +159,19 @@ object syntax: end syntax +object mutable: + + type CacheKey = shared.CacheKey + val CacheKey: shared.CacheKey.type = shared.CacheKey + + type ToCacheKey[A] = shared.ToCacheKey[A] + val ToCacheKey: shared.ToCacheKey.type = shared.ToCacheKey + + type QuickCache[A] = shared.QuickCache[A] + val QuickCache: shared.QuickCache.type = shared.QuickCache + +end mutable + val logger: indigo.shared.IndigoLogger.type = indigo.shared.IndigoLogger type Startup[SuccessType] = shared.Startup[SuccessType] diff --git a/indigo/indigo/src/main/scala/indigo/shared/QuickCache.scala b/indigo/indigo/src/main/scala/indigo/shared/QuickCache.scala index db6d87c71..8463e3319 100644 --- a/indigo/indigo/src/main/scala/indigo/shared/QuickCache.scala +++ b/indigo/indigo/src/main/scala/indigo/shared/QuickCache.scala @@ -1,5 +1,14 @@ package indigo.shared +/** QuickCache is a handy way to avoid expensive re-calculation of data. It is a side-effecting arrangement that Indigo + * uses a lot internally, that can also be used by cautious game devs. Simple example: + + ``` + given QuickCache[MyExpensiveObject] = QuickCache.empty + + QuickCache("key")(obj) + ``` + */ final class QuickCache[A](private val cache: scalajs.js.Dictionary[A]): def fetch(key: CacheKey): Option[A] =