0.0.2 • Published 11 months ago

pseudo-control-client v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

pseudo-control-client

pseudo-control-client is part of pseudo-control. Please see https://github.com/aooen/pseudo-control.

Initialize (example)

  1. Build pseudo-control-client.
    yarn install
    yarn build
  2. Embed bundled script file, then run ready command when window loaded.
    <link rel="stylesheet" href="~~~/dist/style.css" />
    <script src="~~~/dist/pseudo-control-client.js"></script>
    <script>
      window.addEventListener('load', () => {
        const remoteControlKey = window.pseudoControl('ready', {
          host: 'localhost', // example
          controlPort: 26610,
          sessionPort: 26611
        })
        // show remoteControlKey like this (example)
        /*
        const indicator = document.createElement('small')
        indicator.textContent = 'identification key for technical support: ' + remoteControlKey
        document.body.appendChild(indicator)
        */
      })
    </script>
  3. Present the returned key string in a place where the user can easily find it.
  4. All done! You can control through the key in pseudo-control-manager application. Try it!

Command list

ready

window.pseudoControl('ready', {
  host: 'localhost', // example
  controlPort: 26610,
  sessionPort: 26611
}): string
  • Standby for receive remote control request and return string key to identify user.
  • This command can create a element used for modal displaying.

disconnect

window.pseudoControl('disconnect'): void
  • Disconnect all communication and rollback like before ready status.

log

window.pseudoControl('log', message: string): void
  • Log message for event tracking. The message is forwarded to the technical supporter.
  • It only works while remote control.