Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How to intialize a service globally and export to be used by other modules in svelte js

$
0
0

I am trying to integrate mixpanel in my svelte project. To intializae mixpanel instance i need to do something like :

import {mixpanel} from 'mixpanel-browser'mixpanel.init('TOKEN', {options});// and then can use it's functions like mixpanel.track('user_Action')mixapnel.identify('...')

Doing it for every file doesn't seem to be a good idea but how do i do it in svelte ? like instantiate this at one place and then use it everywhere else ?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>