vue-meta icon indicating copy to clipboard operation
vue-meta copied to clipboard

Suggested improvements to documentation for "callback" and "skip"

Open rickthepick opened this issue 4 years ago • 1 comments

  1. In the documentation please explain how a script element in the array is triggered by the change in value of the "skip" expression. Are you periodically polling? Are you injecting a callback on each of the "callback"s and in the callback you are reevaluating all of the "skip" expressions? If we don't explain the mechanism it seems like magic and personally I didn't use this feature because I didn't understand how it works.

  2. Can we rename "skip" to maybe "wait"? I think "wait" captures the meaning that this expression will be reevaluated.

  3. Maybe have the example be something like this. Seems like this is the most common use case maybe? How about two examples?

script: [
        {
          src: "/js/partOne.js",
          hid: "partOne",
          callback: () => {
            this.readyForPartTwo = true;
          },
        },
        {
          src: "/js/partTwoRequiresPartOne.js",
          skip: !this.readyForPartTwo,
        },
],

rickthepick avatar Feb 16 '21 15:02 rickthepick

Its probably better explained (by example) by looking at this example: https://github.com/nuxt/vue-meta/blob/master/examples/async-callback/app.js

I might consider renaming these props for v3

pimlie avatar Feb 28 '21 10:02 pimlie