@graffiti-garden/wrapper-vue
    Preparing search index...

    Function useGraffitiDiscover

    • The Graffiti.discover method as a reactive composable for use in the Vue composition API.

      Its corresponding renderless component is GraffitiDiscover.

      The arguments of this composable are largely the same as Graffiti.discover, with the first two arguments and each option, including the optional session, also accepting Refs or getters. Set options.autopoll to true to automatically poll for new objects. As the arguments change, the output will automatically update. Reactivity only triggers when the root array or object changes, not when the elements or properties change. If you need deep reactivity, wrap your argument in a getter.

      Type Parameters

      • Schema extends JSONSchema

      Parameters

      • channels: MaybeRefOrGetter<string[]>
      • schema: MaybeRefOrGetter<Schema>
      • Optionaloptions:
            | GraffitiVueDiscoverOptions
            | MaybeRefOrGetter<GraffitiSession | null | undefined>
      • OptionallegacyAutopoll: MaybeRefOrGetter<boolean>

        Pass { session, autopoll } as the third argument instead.

      Returns {
          error: Ref<Error | null, Error | null>;
          isFirstPoll: Ref<boolean, boolean>;
          objects: Ref<GraffitiObject<Schema>[], GraffitiObject<Schema>[]>;
          poll: () => Promise<void>;
      }

      • objects: A ref that contains an array of Graffiti objects.
      • poll: A function that can be called to manually check for objects. If a poll is already running, it waits for that poll.
      • error: A ref containing a failure of the entire discovery, or null. On failure, retries are automatic (e.g. to reconnect to the network).
      • isFirstPoll: A boolean ref that is true until the first successful discovery completes.