codecast
v0.0.2
Published
Development tool that allows local code to be easily casted to a receiver with hot reloading
Downloads
2
Readme
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