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 🙏

© 2024 – Pkg Stats / Ryan Hefner

twitchext-vuex

v0.2.2

Published

A Vuex module library for Twitch Extension

Downloads

15

Readme

Twitch-Ext-Vuex

An abstraction of the Twitch Extension helper for VueX

Description

This lib allow you to abstract the Twitch extension helper for your twitch extension project using Vue / Vuex.

You can easily have a reactive Twitch extension without worrying about all the set up.

Dependencies

  • Vue
  • Vuex

How to use

Use the Vue plugin

By default the store will be accessible on the twitch module.

You need to create the store before using it in the plugin.

import Vue from "vue";
import App from "./App";
import Vuex from "vuex";
import { ExtensionPlugin } from "twitchext-vuex";

Vue.use(Vuex);

const store = new Vuex.Store();

Vue.use(ExtensionPlugin, { store });

new Vue({
  el: "#app",
  store,
  render: h => h(App)
});

You will be able to to access the data as computed values

computed(){
  ...
  opaqueId(){
    return this.$twitchExtension.viewer.id
  }
}

Store description

General data

The data structure is based on the - Twitch Extension Helper

You can access the data using the same structure

...
computed:{
  ...
  opaqueId(){
    return this.$twitchExtension.viewer.id
  }
}

Custom data

bits

bits.getBitsAmount(sku:string):number return the bits amount of given sku. Return 0 if the sku doesn't exist.

bits.hasOngoingBitTransaction:boolean return if the user has a bits transaction going on.

Channel

channel.initialized:boolean return if the channel information have been set.

id:string return the channel id of the stream.

Configuration Service

configuration.initialized:boolean return if the configuration service has been set.

Position

position.initialized:boolean return if the position information have been set.

Viewer

viewer.initialized:boolean return if the viewer information have been set.

Context

For the default data structure see the OnContext method.

The same structure is used to store the data under the context field.

context.initialized:boolean return if the context information have been set.

Query Params

For the default data structure see the Query Params doc.

Use this.$twitchExtension.queryParams to access the values.

Values for testing

When developing your extension, you might want to force some feature flags to true.

These are only meant to make testing easier! Remember to turn these values off when sending to review.

Force isBitEnabled to true

Set the value

Vue.use(ExtensionPlugin, { store, settings:{
  forceFlags:{
    forceIsBitsEnabled:true
  }  
}});

Access it

this.$store.state.forceIsBitsEnabled

Use a custom main module name

You can use a custom VueX module name to match your project needs

Vue.use(Vuex);

const store = new Vuex.Store();

Vue.use(ExtensionPlugin, { store, module:'extension' });

new Vue({
  el: "#app",
  store,
  render: h => h(App)
});

Other frameworks

React

You can use my other package for React : TwitchExt-React

Resources