npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@iebh/vuex-tera-sync

v2.0.4

Published

A Vuex plugin for syncing state with Tera

Downloads

26

Readme

vuex-tera-sync

A Vuex plugin for syncing state with Tera.

Installation

npm install @iebh/vuex-tera-sync

Usage

Note: Make sure to remove any localforage/localstorage references in the store as this will create a bug where state gets carried over on new projects.

Store Configuration

In your Vuex store configuration file (e.g. store.js), create and export the sync plugin, then add it to your store:

import Vue from 'vue'
import Vuex from 'vuex'
import { createSyncPlugin } from '@iebh/vuex-tera-sync';

Vue.use(Vuex)

// Create and export the TERA sync plugin
// Parameters:
// 1. key: unique identifier for the tool (e.g. 'wordFreq')
// 2. debug: boolean for debug mode
// 3. options: configuration object (optional)
export const teraSyncPlugin = createSyncPlugin('wordFreq', false, {
    debounceMs: 100 // Debounce time in milliseconds
})

export default new Vuex.Store({
    modules: {
        // Your store modules
    },
    plugins: [teraSyncPlugin]
})

Application Initialization

In your main application file (e.g. main.js), import the store and plugin, then initialize them with your Vue instance:

import Vue from 'vue'
import App from './App.vue'
import store, { teraSyncPlugin } from './store'
import TeraFy from "@iebh/tera-fy/dist/terafy.es2019.js"
import TerafyVue from "@iebh/tera-fy/dist/plugin.vue2.es2019.js"

// Initialize TeraFy
const terafy = new TeraFy()
    .set("devMode", process.env.VUE_APP_TERAFY_DEV)
    .setIfDev("verbosity", process.env.VUE_APP_TERAFY_VERBOSITY)
    .use(TerafyVue);

(async ()=> {
    const app = new Vue({
        render: h => h(App),
        store,
        created() {
            // Set up the sync plugin
            teraSyncPlugin(store).setVueInstance(this)
        },
        beforeDestroy() {
            // Cleanup
            teraSyncPlugin(store).destroy()
        }
    });

    // Initialize Tera
    await terafy.init({
        app,
        Vue
    });

    // Signal that Tera is ready
    teraSyncPlugin(store).setTeraReady();

    app.$mount("#app");
})()

API

Plugin Creation

  • createSyncPlugin(key, debug, options): Creates the Vuex plugin for syncing with Tera
    • key: String - Unique identifier for the tool (e.g. 'wordFreq')
    • debug: Boolean - Enable debug mode
    • options: Object - Configuration options
      • debounceMs: Number - Debounce time in milliseconds (default: 100)

Plugin Methods

  • setVueInstance(instance): Sets the Vue instance for the sync plugin
  • setTeraReady(): Signals that Tera is ready and initiates the first sync
  • destroy(): Cleans up the plugin when the Vue instance is destroyed

Best Practices

  1. Always export the plugin instance if you need to access its methods outside the store
  2. Call setVueInstance() in your Vue app's created hook
  3. Call destroy() in your Vue app's beforeDestroy hook to prevent memory leaks
  4. Initialize Tera before calling setTeraReady()

License

MIT