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 🙏

© 2026 – Pkg Stats / Ryan Hefner

obvious-vue

v0.2.3

Published

a library to help using obvious in vue2.x application

Downloads

8

Readme

obvious-vue

Coverage Status release lastCommit

The official library to help you use obvious in Vue application

Install

npm:

npm install vue obvious-vue

umd:

<script src="https://unpkg.com/obvious-vue@{version}/dist/index.umd.js"></script>
import Vue from 'vue'
import ObviousVue from 'obvious-vue'

Vue.use(ObviousVue)

Usage

You should provide the $bus and $socket on the root, and they will be injected into all the child components and will be available on them as this.$bus and this.$socket

const $bus = window.__Bus__.host
const $socket = $bus.createSocekt()

const app = new Vue({
  $bus,
  $socket
})

app.$mount(document.getElementById('root'))

state

You can declare the obviousData option to perform the two-way binding for Vue data and obvious state

<template>
  <div :style="{color: theme}">{{ userName }}</div>
</template>

<script>
const anotherBus = window.__Bus__.anotherBus
const anotherSocket = anotherBus.createSocket()

export default {
  name: 'SubComponent',

  obviousData: {
    userName: 'user.name', // Two-way binding for this.userName and this.$socket.getState('user.name')
    theme: { // Two-way binding for this.theme and anotherSocket.getState('themeColor')
      state: 'themeColor',
      socket: anotherSocket
    }
  }
}
</script>

broadcast and unicast

You can declare the broadcast and unicast option to register some broadcast and unicast events for obvious

<template>
  <ul ref="container">
    <li v-for="item of list">{{ item }}</li>
  </div>
</template>

<script>
const anotherSocket = window.__Bus__.anotherBus.createSocket()

export default {
  data: {
    list: []
  },

  broadcast: {
    addItem(item) { // this.$socket.onBroadcast('addItem', handler)
      this.list.push(item)
    },
    addItemByAnotherSocket: { // anotherSocket.onBroadcast('addItemByAnotherSocket', handler)
      handler(item) {
        this.list.push(item)
      },
      socket: anotherSocket
    },
    deleteItem(index) {
      this.list.splice(index, 1)
    },
  },

  unicast: {
    getItem(index) {// this.$socket.onUnicast('getItem', handler)
      return this.list[index]
    },
    getItemByAnotherSocket:{// anotherSocket.onUnicast('getItem', handler)
      handler(index) {
        return this.list[index]
      },
      socket: anotherSocket
    }
  }
}
</script>

set the default socket

The default socket to handle all states and events is this.$socket, you can change it by declare the socket option

<script>
const anotherSocket = window.__Bus__.anotherBus.createSocket()
export default {
  socket,

  obviousData: {
    name: 'name' // Two-way binding for this.name and anotherSocket.getState('name')
  },
  broadcast: {
    changeName(value) { // anotherSocket.onBroadcast('changeName', handler)
      this.name = value
    },
    getName() { // anotherSocket.onUnicast('getName', handler)
      return this.name
    }
  }
}
</script>

activate obvious app

after using ObviousVue, there will be a global component named obvious-app to help you easily activate an obvious app, the app will be bootstrapped when the component is mounted and will be reactivated once the props activate-config is changed, and when the component is destroyed, the app will be destroyed too

const bus = window.__Bus__.host

bus.createApp('react-app')
  .bootstrap(async (config) => {
    ReactDOM.render(<App />, config.mountPoint)
  })
  .activate(async (config) => {
    console.log(config.message)
  })
  .destroy(async (config) => {
    console.log(config.message)
    ReactDOM.unmountComponentAtNode(config.mountPoint)
  })
<template>
  <obvious-app 
    ctx="react-app" 
    :activate-config="activateConfig"
    :destroy-config="destroyConfig"
  />
</template>

<script>
export default {
  data() {
    return {
      activateConfig: {
        message: 'I was activated by a vue app'
      },
      destroyConfig: {
        message: 'I was destroyed by a vue app'
      }
    }
  }
}
</script>

all the props and events of obvious-app are below

props:

|name|required|default|description| |----|----|-------|-----------| |bus|false|this.$bus|the bus to activate the target app| |ctx|true| - |the context of the app to activate| |activate-config|false|{}| the config argument of activating| |destroy-config|false|{}| the config argument of destroying|

events:

|name|description| |----|-----------| |activated|emitted after the app is activated| |destroyed|emitted after the app is destroyed| |error|emmited when an error is throwed during activating or destroying|

License

obvious-vue is MIT licensed