2.0.3 • Published 6 years ago

w-spot v2.0.3

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

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

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago