@factor/app
Advanced tools
Comparing version 1.0.0-beta.17 to 1.0.0-beta.18
import "@factor/tools" // prevent load order issues | ||
import { emitEvent } from "@factor/tools/events" | ||
import { getRouter } from "@factor/app/router" | ||
import { createRouter } from "@factor/app/router" | ||
import { getStore } from "@factor/app/store" | ||
@@ -19,3 +19,3 @@ import { runCallbacks } from "@factor/tools/filters" | ||
const store = getStore() | ||
const router = getRouter() | ||
const router = createRouter() | ||
@@ -37,5 +37,3 @@ // Extend with mixin, etc... happens after router and store | ||
// The is the primary mechanism for initializing users since authenticated content isn't SSR'd | ||
setTimeout(() => { | ||
emitEvent("app-mounted") | ||
}, 0) | ||
setTimeout(() => emitEvent("app-mounted"), 0) | ||
}, | ||
@@ -42,0 +40,0 @@ render: h => h(site) |
@@ -6,2 +6,14 @@ # Change Log | ||
# [1.0.0-beta.18](https://github.com/fiction-com/factor/compare/v1.0.0-beta.17...v1.0.0-beta.18) (2019-11-12) | ||
### Bug Fixes | ||
* dash ([1e979a5](https://github.com/fiction-com/factor/commit/1e979a5e865400f4bcef6e106532dfdc13bea5a7)) | ||
* **dashboard:** layout improvements ([f0e90b2](https://github.com/fiction-com/factor/commit/f0e90b2786f95a29deb024a67cc36adb8e1d2856)) | ||
# [1.0.0-beta.17](https://github.com/fiction-com/factor/compare/v1.0.0-beta.16...v1.0.0-beta.17) (2019-11-11) | ||
@@ -8,0 +20,0 @@ |
@@ -7,4 +7,4 @@ import { applyFilters, runCallbacks } from "@factor/tools/filters" | ||
let __observables | ||
let __components | ||
let __observables = {} | ||
let __components = {} | ||
@@ -11,0 +11,0 @@ export async function extendApp(options = {}) { |
{ | ||
"name": "@factor/app", | ||
"version": "1.0.0-beta.17", | ||
"version": "1.0.0-beta.18", | ||
"main": "index.js", | ||
@@ -22,3 +22,3 @@ "license": "GPL-2.0", | ||
}, | ||
"gitHead": "41e275607105436b2ef4fe8f2416d0002d0257f5" | ||
"gitHead": "1354ddcb3d3df6988ec0c8c7bdca8613c6af9663" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { applyFilters, runCallbacks, addCallback } from "@factor/tools/filters" | ||
import { applyFilters, runCallbacks } from "@factor/tools/filters" | ||
import { emitEvent } from "@factor/tools/events" | ||
@@ -12,18 +12,27 @@ import Vue from "vue" | ||
//addCallback("initialize-server", () => addAppRoutes()) | ||
addCallback("initialize-app", () => addAppRoutes(), { priority: 300 }) | ||
// addCallback("initialize-app", () => createRouter(), { priority: 300 }) | ||
const __router = new VueRouter({ | ||
mode: "history", | ||
scrollBehavior: (to, from, saved) => { | ||
return to.hash ? { selector: to.hash } : (saved ? saved : { x: 0, y: 0 }) | ||
}, | ||
parseQuery: query => qs.parse(query), | ||
stringifyQuery: query => (qs.stringify(query) ? `?${qs.stringify(query)}` : "") | ||
}) | ||
let __router | ||
// Load hooks for client navigation handling | ||
// Don't run on server as this causes the hooks to run twice | ||
if (process.env.FACTOR_SSR == "client") { | ||
__router.beforeEach((to, from, next) => hookClientRouterBefore(to, from, next)) | ||
__router.afterEach((to, from) => hookClientRouterAfter(to, from)) | ||
export function createRouter() { | ||
const router = new VueRouter({ | ||
mode: "history", | ||
routes: applyFilters("routes", []).filter(_ => _), | ||
scrollBehavior: (to, from, saved) => { | ||
return to.hash ? { selector: to.hash } : (saved ? saved : { x: 0, y: 0 }) | ||
}, | ||
parseQuery: query => qs.parse(query), | ||
stringifyQuery: query => (qs.stringify(query) ? `?${qs.stringify(query)}` : "") | ||
}) | ||
// Load hooks for client navigation handling | ||
// Don't run on server as this causes the hooks to run twice | ||
if (process.env.FACTOR_SSR == "client") { | ||
router.beforeEach((to, from, next) => hookClientRouterBefore(to, from, next)) | ||
router.afterEach((to, from) => hookClientRouterAfter(to, from)) | ||
} | ||
__router = router | ||
return router | ||
} | ||
@@ -35,9 +44,2 @@ | ||
// TODO check for duplicates | ||
export function addAppRoutes() { | ||
const routes = applyFilters("routes", []).filter(_ => _) | ||
addRoutes(routes) | ||
} | ||
// If called before 'createRouter' then add to callback | ||
@@ -44,0 +46,0 @@ export function addRoutes(routeConfig) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44018
510