Skip to content

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

License

Notifications You must be signed in to change notification settings

lmckeen/CodeCast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks