From 9d14387cda2219259e9673f579f1b2341fd94d75 Mon Sep 17 00:00:00 2001 From: pimlie Date: Fri, 13 Sep 2019 13:41:26 +0200 Subject: [PATCH] feat: enable setting refreshOnceOnNavigation during runtime --- src/shared/$meta.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/shared/$meta.js b/src/shared/$meta.js index 6df77b11..97ed9693 100644 --- a/src/shared/$meta.js +++ b/src/shared/$meta.js @@ -2,6 +2,7 @@ import refresh from '../client/refresh' import inject from '../server/inject' import { showWarningNotSupported } from '../shared/log' import { addApp } from './additional-app' +import { addNavGuards } from './nav-guards' import { pause, resume } from './pausing' import { getOptions } from './options' @@ -13,6 +14,11 @@ export default function $meta (options = {}) { */ return { getOptions: () => getOptions(options), + setOptions: ({ refreshOnceOnNavigation } = {}) => { + if (refreshOnceOnNavigation) { + addNavGuards(this) + } + }, refresh: () => refresh(this, options), inject: () => process.server ? inject(this, options) : showWarningNotSupported(), pause: () => pause(this),