Skip to content

realglobe-Inc/w-spot

Repository files navigation

w-spot

Build Status npm Version JS Standard

Signal converter for w

Installation

$ npm install w-spot --save

Usage

'use strict'

const wSpot = require('w-spot')

async function tryExample () {
  // Create multiple spot
  const NewYork = wSpot()
  const HongKong = wSpot()
  const Japan = wSpot()

  {
    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!')
  }

  // Connect each spot
  await Japan.connect(HongKong)
  await HongKong.connect(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