ThemeParks.wiki Parks API - v2.0.0
    Preparing search index...

    Function reusable

    • Decorator to reuse promises while they're pending, and optionally cache the result forever

      Parameters

      Returns MethodDecorator

      class MyClass {
      // Reuse promise while pending (default behavior)
      @reusable()
      async fetchData() {
      return await fetch('...');
      }

      // Cache result forever (singleton pattern)
      @reusable({forever: true})
      async init() {
      // This will only run once
      return await this.setup();
      }
      }