0.0.2 • Published 4 years ago

codecast v0.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

CodeCast

Allows local code to be easily casted to a chromecast receiver with hot reloading support

How to use CodeCast

npm install codecast

Sender

import { CodeCast } from 'codecast/sender'

window['__onGCastApiAvailable'] = function(isAvailable) {
  if (isAvailable) {
    const codeCast = new CodeCast()
    const code = 'resolve(navigator.userAgent)'

    codeCast.sendString(code).then(userAgent => {
      console.log(userAgent)
    })
  }
}

Receiver

import { CodeCast } from 'codecast/receiver'

const codeCast = new CodeCast()

codeCast.start()

API Docs

Sender

//Request URL contents and send it to the receiver as JS code to be run
send(url: string): Promise

//Send text to the receiver as JS code to be run
sendString(text: string): Promise

//Send a message to the receiver telling it to reload
reload(): void

Receiver

//Proxy for the CastReceiverContext start function 
start(options: CastReceiverOptions): CastReceiverContext

Demo

Live

https://lukemckeen.com/CodeCast-Demo/dist/sender

Repo

https://github.com/lmckeen/CodeCast-Demo

0.0.2

4 years ago

0.0.1

4 years ago