react-chromecast-caf 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ const load = (() => {
|
|
|
50
50
|
if (isAvailable) {
|
|
51
51
|
resolve({
|
|
52
52
|
cast,
|
|
53
|
+
chrome,
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
};
|
|
@@ -62,6 +63,7 @@ const load = (() => {
|
|
|
62
63
|
const useChromecastCafSender = () => {
|
|
63
64
|
const [sender, setSender] = useState({
|
|
64
65
|
cast: null,
|
|
66
|
+
chrome: null,
|
|
65
67
|
});
|
|
66
68
|
useEffect(() => {
|
|
67
69
|
load().then((sender) => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/useChromecastCafReceiver.ts","../src/useChromecastCafSender.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { ReceiverCast } from './receiver-capture'\n\nexport type Receiver = {\n\tcast: ReceiverCast\n\t// @TODO: Add framework and debug\n}\n\nconst load = (() => {\n\tlet promise: Promise<Receiver> | null = null\n\n\treturn () => {\n\t\tif (promise === null) {\n\t\t\tpromise = new Promise((resolve) => {\n\t\t\t\tconst script = document.createElement('script')\n\t\t\t\tscript.src =\n\t\t\t\t\t'https://www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js'\n\t\t\t\tdocument.body.appendChild(script)\n\n\t\t\t\tconst loop = () => {\n\t\t\t\t\tif ('cast' in window && 'framework' in cast) {\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcast: cast as unknown as ReceiverCast,\n\t\t\t\t\t\t})\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tloop()\n\t\t\t\t\t}, 100)\n\t\t\t\t}\n\t\t\t\tloop()\n\t\t\t})\n\t\t}\n\t\treturn promise\n\t}\n})()\n\nexport const useChromecastCafReceiver = () => {\n\tconst [receiver, setReceiver] = useState<Receiver | { cast: null }>({\n\t\tcast: null,\n\t})\n\n\tuseEffect(() => {\n\t\tload().then((sender) => {\n\t\t\tsetReceiver(sender)\n\t\t})\n\t}, [])\n\n\treturn receiver\n}\n","import { useEffect, useState } from 'react'\nimport type { SenderCast } from './sender-capture'\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/useChromecastCafReceiver.ts","../src/useChromecastCafSender.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { ReceiverCast } from './receiver-capture'\n\nexport type Receiver = {\n\tcast: ReceiverCast\n\t// @TODO: Add framework and debug\n}\n\nconst load = (() => {\n\tlet promise: Promise<Receiver> | null = null\n\n\treturn () => {\n\t\tif (promise === null) {\n\t\t\tpromise = new Promise((resolve) => {\n\t\t\t\tconst script = document.createElement('script')\n\t\t\t\tscript.src =\n\t\t\t\t\t'https://www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js'\n\t\t\t\tdocument.body.appendChild(script)\n\n\t\t\t\tconst loop = () => {\n\t\t\t\t\tif ('cast' in window && 'framework' in cast) {\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcast: cast as unknown as ReceiverCast,\n\t\t\t\t\t\t})\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tloop()\n\t\t\t\t\t}, 100)\n\t\t\t\t}\n\t\t\t\tloop()\n\t\t\t})\n\t\t}\n\t\treturn promise\n\t}\n})()\n\nexport const useChromecastCafReceiver = () => {\n\tconst [receiver, setReceiver] = useState<Receiver | { cast: null }>({\n\t\tcast: null,\n\t})\n\n\tuseEffect(() => {\n\t\tload().then((sender) => {\n\t\t\tsetReceiver(sender)\n\t\t})\n\t}, [])\n\n\treturn receiver\n}\n","import { useEffect, useState } from 'react'\nimport type { SenderCast } from './sender-capture'\nimport { SenderChrome } from './sender-capture'\n\nexport type Sender = {\n\tcast: SenderCast\n\tchrome: SenderChrome\n}\n\nconst load = (() => {\n\tlet promise: Promise<Sender> | null = null\n\n\treturn () => {\n\t\tif (promise === null) {\n\t\t\tpromise = new Promise((resolve) => {\n\t\t\t\tconst script = document.createElement('script')\n\t\t\t\tscript.src =\n\t\t\t\t\t'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1'\n\t\t\t\twindow.__onGCastApiAvailable = (isAvailable) => {\n\t\t\t\t\tif (isAvailable) {\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tcast,\n\t\t\t\t\t\t\tchrome,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdocument.body.appendChild(script)\n\t\t\t})\n\t\t}\n\t\treturn promise\n\t}\n})()\n\nexport const useChromecastCafSender = () => {\n\tconst [sender, setSender] = useState<\n\t\t| Sender\n\t\t| {\n\t\t\t\tcast: null\n\t\t\t\tchrome: null\n\t\t }\n\t>({\n\t\tcast: null,\n\t\tchrome: null,\n\t})\n\n\tuseEffect(() => {\n\t\tload().then((sender) => {\n\t\t\tsetSender(sender)\n\t\t})\n\t}, [])\n\n\treturn sender\n}\n"],"names":["load"],"mappings":";;AAQA,MAAMA,MAAI,GAAG,CAAC,MAAK;IAClB,IAAI,OAAO,GAA6B,IAAI;AAE5C,IAAA,OAAO,MAAK;AACX,QAAA,IAAI,OAAO,KAAK,IAAI,EAAE;AACrB,YAAA,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;gBACjC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC;AAC/C,gBAAA,MAAM,CAAC,GAAG;AACT,oBAAA,kFAAkF;AACnF,gBAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;gBAEjC,MAAM,IAAI,GAAG,MAAK;oBACjB,IAAI,MAAM,IAAI,MAAM,IAAI,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AAC,CAAC;QACH;AACA,QAAA,OAAO,OAAO;AACf,IAAA,CAAC;AACF,CAAC,GAAG;AAEG,MAAM,sBAAsB,GAAG,MAAK;AAC1C,IAAA,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAMlC;AACD,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,MAAM,EAAE,IAAI;AACZ,KAAA,CAAC;IAEF,SAAS,CAAC,MAAK;AACd,QAAA,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,KAAI;YACtB,SAAS,CAAC,MAAM,CAAC;AAClB,QAAA,CAAC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,MAAM;AACd;;;;"}
|
package/dist/sender-capture.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { SenderCast } from './sender-capture';
|
|
2
|
-
|
|
2
|
+
import { SenderChrome } from './sender-capture';
|
|
3
3
|
export type Sender = {
|
|
4
4
|
cast: SenderCast;
|
|
5
|
+
chrome: SenderChrome;
|
|
5
6
|
};
|
|
6
7
|
export declare const useChromecastCafSender: () => Sender | {
|
|
7
8
|
cast: null;
|
|
9
|
+
chrome: null;
|
|
8
10
|
};
|