From 894738889acaf79bece1905c618f9b51497657fb Mon Sep 17 00:00:00 2001 From: hensm Date: Tue, 19 Mar 2019 18:35:25 +0000 Subject: [PATCH] Minor cast.framework changes --- ext/src/shim/framework/classes/CastSession.ts | 2 +- ext/src/shim/framework/index.ts | 14 ++++++++++---- ext/src/shim/index.ts | 11 ++++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ext/src/shim/framework/classes/CastSession.ts b/ext/src/shim/framework/classes/CastSession.ts index f4bf169..5294f77 100644 --- a/ext/src/shim/framework/classes/CastSession.ts +++ b/ext/src/shim/framework/classes/CastSession.ts @@ -25,7 +25,7 @@ type EventHandler = (eventData: type MessageListener = (namespace: string, message: string) => void; -export default class RemotePlayer { +export default class CastSession { constructor (sessionObj: Session, state: string) { console.info("STUB :: CastSession#constructor"); } diff --git a/ext/src/shim/framework/index.ts b/ext/src/shim/framework/index.ts index ccb9493..885c0e2 100644 --- a/ext/src/shim/framework/index.ts +++ b/ext/src/shim/framework/index.ts @@ -44,16 +44,22 @@ export default { , RemotePlayer, RemotePlayerChangedEvent, RemotePlayerController , SessionStateEventData, VolumeEventData - , CastContext: Object.assign(CastContext, { - getInstance () { + /** + * CastContext class with an extra getInstance method used to + * instantiate and fetch a singleton instance. + */ + , CastContext: { + ...CastContext + + , getInstance () { if (castContext) { - return castContext; + return castContext } castContext = new CastContext(); return castContext; } - }) + } , VERSION: "1.0.07" diff --git a/ext/src/shim/index.ts b/ext/src/shim/index.ts index ddf38ea..eb3ca04 100755 --- a/ext/src/shim/index.ts +++ b/ext/src/shim/index.ts @@ -7,13 +7,14 @@ import { onMessage } from "./messageBridge"; const global = (window as any); -if (!global.chrome) { - global.chrome = {}; -} - +global.chrome = {}; global.chrome.cast = cast; - +/** + * If loaded within a page via a