@factor/app
Advanced tools
Comparing version 1.7.6 to 1.7.8
22
app.ts
@@ -5,7 +5,9 @@ import "@factor/app" | ||
import Vue, { CreateElement, VNode } from "vue" | ||
import { createRouter } from "@factor/app/router" | ||
import Vue, { CreateElement, VNode, VueConstructor } from "vue" | ||
import VueRouter from "vue-router" | ||
import Vuex from "vuex" | ||
import VueMeta from "vue-meta" | ||
import { emitEvent } from "@factor/api/events" | ||
import { createStore } from "@factor/app/store" | ||
import { createFactorRouter } from "@factor/app/router" | ||
import { createFactorStore } from "@factor/app/store" | ||
import { runCallbacks } from "@factor/api/hooks" | ||
@@ -16,2 +18,10 @@ import { setting } from "@factor/api/settings" | ||
Vue.use(VueRouter) | ||
Vue.use(Vuex) | ||
Vue.use(VueMeta, { keyName: "metaInfoCore" }) | ||
export const getPrimaryApp = (): VueConstructor => { | ||
return Vue | ||
} | ||
/** | ||
@@ -30,4 +40,4 @@ * Expose a factory function that creates a fresh set of store, router, | ||
const store = createStore() | ||
const router = createRouter() | ||
const store = createFactorStore() | ||
const router = createFactorRouter() | ||
@@ -34,0 +44,0 @@ /** |
{ | ||
"name": "@factor/app", | ||
"version": "1.7.6", | ||
"version": "1.7.8", | ||
"license": "GPL-2.0", | ||
@@ -15,3 +15,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "acfe04352dbcd00601009a9cd349d06f42e66dd2" | ||
"gitHead": "6d683fba432df91052bf221122d088a7811a773b" | ||
} |
import { applyFilters, runCallbacks, addFilter } from "@factor/api/hooks" | ||
import { emitEvent } from "@factor/api/events" | ||
import Vue from "vue" | ||
import VueRouter, { RouteConfig, Route, RouterOptions, Location } from "vue-router" | ||
import qs from "qs" | ||
import { uniq } from "@factor/api" | ||
Vue.use(VueRouter) | ||
let __initialPageLoad = true | ||
let __routerInstance: VueRouter | ||
declare module "vue/types/vue" { | ||
@@ -117,3 +118,3 @@ export interface VueConstructor { | ||
*/ | ||
export const createRouter = (): VueRouter => { | ||
export const createFactorRouter = (): VueRouter => { | ||
const routes: RouteConfig[] = applyFilters("routes", []).filter((_: RouteConfig) => _) | ||
@@ -149,3 +150,3 @@ | ||
Vue.$router = router | ||
__routerInstance = router | ||
@@ -156,6 +157,13 @@ return router | ||
export const getRouter = (): VueRouter => { | ||
return Vue.$router | ||
return __routerInstance | ||
} | ||
/** | ||
* Set the router from an external source, needed for tests | ||
*/ | ||
export const setRouter = (r: VueRouter): void => { | ||
__routerInstance = r | ||
} | ||
/** | ||
* Add routes to app | ||
@@ -162,0 +170,0 @@ * Allows for in content or dashboard |
import { runCallbacks, applyFilters, stored } from "@factor/api" | ||
import { getObservables } from "@factor/app" | ||
import Vue from "vue" | ||
import { Route } from "vue-router" | ||
import { FactorPostState } from "@factor/post/types" | ||
import Vue from "vue" | ||
import veil from "./veil.vue" | ||
export default (): any => { | ||
return Vue.extend({ | ||
data() { | ||
data(): object { | ||
return { | ||
@@ -19,4 +20,6 @@ scrollClass: "", | ||
ui(this: any): string { | ||
const { meta = {} } = this.$route.matched.find((_: Route) => _.meta.ui) || {} | ||
const route = this.$route | ||
const { meta = {} } = route.matched.find((_: Route) => _.meta.ui) || {} | ||
const ui = meta.ui || "app" | ||
@@ -63,3 +66,3 @@ | ||
}, | ||
mounted() { | ||
mounted(): void { | ||
this.setScrollClass() | ||
@@ -69,3 +72,3 @@ window.addEventListener("scroll", () => this.setScrollClass()) | ||
async serverPrefetch() { | ||
async serverPrefetch(): Promise<void> { | ||
await runCallbacks("global-prefetch", this.$route) | ||
@@ -72,0 +75,0 @@ return |
@@ -5,3 +5,2 @@ import Vuex from "vuex" | ||
import { ObjectId } from "@factor/post/types" | ||
Vue.use(Vuex) | ||
@@ -16,3 +15,3 @@ let __store: Store<object> | undefined | ||
export const createStore = (): Store<object> => { | ||
export const createFactorStore = (): Store<object> => { | ||
__store = new Vuex.Store({ | ||
@@ -19,0 +18,0 @@ strict: false, |
@@ -12,2 +12,3 @@ /** | ||
import VueRouter from "vue-router" | ||
import { setRouter } from "@factor/api" | ||
import factorSite from "../../site.vue" | ||
@@ -34,3 +35,3 @@ | ||
Vue.$router = router | ||
setRouter(router) | ||
@@ -37,0 +38,0 @@ // Needs router as it assumes $route is there |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
65836
850