progress
progress copied to clipboard
feat: alternative initialize function
This PR adds an initializeProgress function which does the exact same thing as InertiaProgress#init, but with a syntax that is more in-line with the usual functional approach of JavaScript.
Basically, previously, you could do this:
import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/inertia-vue3';
import { InertiaProgress } from '@inertiajs/progress';
createInertiaApp({
resolve: (name: string) => import(`./pages/${name}`),
setup: ({ el, app, props, plugin }) => createApp({ render: () => h(app, props) })
.use(plugin)
.mixin({ methods: { route } })
.mount(el)
});
InertiaProgress.init({ color: '#4B5563' })
Now, you can do just like before, or do this:
import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/inertia-vue3';
import { initializeProgress } from '@inertiajs/progress';
createInertiaApp({
resolve: (name: string) => import(`./pages/${name}`),
setup: ({ el, app, props, plugin }) => createApp({ render: () => h(app, props) })
.use(plugin)
.mixin({ methods: { route } })
.mount(el)
});
initializeProgress({ color: '#4B5563' })
The typings have been updated as well. I'm not 100% sure of the name of initializeProgress. Other ideas:
-
registerProgress -
makeProgress