From 1758db6fb713b51a5d844b49d0aa200ee7a0222d Mon Sep 17 00:00:00 2001 From: Matteo Gabriele Date: Mon, 27 Aug 2018 21:20:31 +0200 Subject: [PATCH] feat: exports all library adds possibility to access the vue-analytics library from outside the Vue scope closes #151 --- src/index.js | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/index.js b/src/index.js index 67ee54d..8e3aa5c 100644 --- a/src/index.js +++ b/src/index.js @@ -1,24 +1,37 @@ import bootstrap from './bootstrap' import lib from './lib' import { update } from './config' -import { onAnalyticsReady } from './helpers' +import * as helpers from './helpers' import ga from 'directives/ga' -import * as exception from 'lib/exception' -import analyticsMiddleware from './vuex-middleware' +import { autotracking as expectionAutotracking } from 'lib/exception' +import vuexMiddleware from './vuex-middleware' export default function install (Vue, options = {}) { update({ ...options, $vue: Vue }) Vue.directive('ga', ga) - Vue.prototype.$ga = Vue.$ga = lib - exception.autotracking(Vue) - + expectionAutotracking(Vue) bootstrap() } -export { - onAnalyticsReady, - analyticsMiddleware -} +// Vuex middleware +export const analyticsMiddleware = vuexMiddleware + +// Helpers +export const onAnalyticsReady = helpers.onAnalyticsReady + +// Event library +export const event = lib.event +export const ecommerce = lib.ecommerce +export const set = lib.set +export const page = lib.page +export const query = lib.query +export const screenview = lib.screenview +export const time = lib.time +export const require = lib.require +export const exception = lib.exception +export const social = lib.social + +