/* eslint-disable import/no-absolute-path */ import { Meteor } from 'meteor/meteor'; import { ReactiveVar } from 'meteor/reactive-var'; import history from '/imports/ui/components/History/History'; export const location = new ReactiveVar(history.location.pathname); if (Meteor.isClient) { // history v5 hands the listener a { location, action } update object // (v4 passed the location directly). history.listen(({ location: loc }) => { location.set(loc.pathname); }); } export const currentLocation = () => location.get(); export const currentLocationHref = () => { if (Meteor.isClient) { return window.location.href; } // FIXME return location.get(); }; export const isHome = () => currentLocation() === '/';