v-spot

1.2.1 • Public • Published

v-spot

Build Status npm Version JS Standard

Spot for v

Installation

$ npm install v-spot --save

Usage

'use strict'

const vSpot = require('v-spot')

async function tryExample () {
  const Spot = vSpot()

  const NewYork = vSpot.clinet()
  const Japan = vSpot.clinet()

  await Spot.listen()
  await NewYork.connect(Spot)
  await Japan.connect(Spot)

  {
    class Person {
      async hi (msg) {
        return `hi, ${msg}`
      }
    }

    // Create a instance to a spot
    const john = NewYork.load(Person, 'jp.realglobe.new-york.john')
    await john.hi('I am in NewYork!')
  }

  {
    // Use remote instance
    const john = await Japan.use('jp.realglobe.new-york.john')
    await john.hi('Calling from Japan!')
  }
}

tryExample().catch((err) => console.error(err))

API Guide

License

This software is released under the MIT License.

Links

Readme

Keywords

Package Sidebar

Install

npm i v-spot

Weekly Downloads

0

Version

1.2.1

License

MIT

Last publish

Collaborators

  • realglobe
  • okunishinishi