New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@enplug/sdk-player

Package Overview
Dependencies
Maintainers
5
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@enplug/sdk-player - npm Package Compare versions

Comparing version 0.7.6 to 0.7.9

dist/player.js

2

package.json
{
"name": "@enplug/sdk-player",
"version": "0.7.6",
"version": "0.7.9",
"description": "Enplug Player SDK",

@@ -5,0 +5,0 @@ "main": "./src/index.ts",

@@ -16,2 +16,7 @@ /**

dispose() {
this.bridge = null;
this.version = null;
}
start(): Promise<boolean> {

@@ -18,0 +23,0 @@ return this.bridge.send(Service.AppStatus, Action.Start);

@@ -13,2 +13,6 @@ /**

dispose() {
this.bridge = null;
}
getList(): Promise<any[]> {

@@ -15,0 +19,0 @@ return this.bridge.send(Service.Assets, Action.GetList);

@@ -24,2 +24,8 @@ /**

dispose() {
this.resolveMap = null;
this.playerEvents = null;
this.version = null;
}
/**

@@ -34,3 +40,2 @@ * Validates the data to be sent to the player and sends them.

send(service: Service, action: Action, payload?: any): Promise<any> {
console.log(`[Enplug SDK: ${this.version}] Sending message from URL ${window.location.href}`);
const appToken = this.getQueryParam('apptoken');

@@ -52,3 +57,2 @@ const token = this.createToken();

this.resolveMap.set(token, [resolve, reject]);
console.log(`[Enplug SDK: ${this.version}] Sending message to player: ${JSON.stringify(message)}`, message);
this.sendToPlayer(message);

@@ -66,3 +70,2 @@ });

receive(message: InboundMessage) {
console.log(`[Enplug SDK: ${this.version}] Received message with action: ${message.action}`, message);
if (message.token && this.resolveMap.has(message.token)) {

@@ -72,3 +75,2 @@ const promiseResolutionFunctions = this.resolveMap.get(message.token);

} else if (message.service === Service.Event) {
console.log(`[Enplug SDK: ${this.version}] Received message with an event: ${message.action}`, message);
this.dispatchEvent(message);

@@ -123,3 +125,2 @@ }

} else if (message.action === Action.Reload) {
console.log(`[Enplug SDK: ${this.version}] App reload requested.`);
window.location.reload();

@@ -126,0 +127,0 @@ } else {

@@ -37,5 +37,5 @@ /**

} catch (e) {
console.log(`[Enplug SDK: ${this.version}] Couldn't parse incoming message: `, e);
// Ignore the message silently.
}
}
}

@@ -15,2 +15,7 @@ /**

public dispose() {
super.dispose();
this.javaGlobal = null;
}
sendToPlayer(message: OutboundMessage) {

@@ -31,5 +36,5 @@ this.javaGlobal.send(JSON.stringify(message));

} catch (e) {
console.log(`[Enplug SDK: ${this.version}] Couldn't parse incoming message: `, e);
// Ignore the message silently.
}
}
}

@@ -20,12 +20,17 @@ /**

};
window.addEventListener('message', this.handleIframeMessage.bind(this));
}
window.addEventListener('message', (event) => {
console.log(`[Enplug SDK: ${this.version}] Received message from ${event.origin},`
+ ` matches origin param: ${event.origin === this.destination}`);
if (event.origin === this.destination) {
this.receive(event.data);
}
});
public dispose() {
window.removeEventListener('message', this.handleIframeMessage.bind(this));
this.destination = null;
super.dispose();
}
handleIframeMessage(event: any) {
if (event.origin === this.destination) {
this.receive(event.data);
}
}
sendToPlayer(message: OutboundMessage) {

@@ -32,0 +37,0 @@ parent.postMessage(message, this.destination);

@@ -32,2 +32,3 @@ /**

// Settings
GetAll = 'get-all',
GetDeviceId = 'get-deviceid',

@@ -34,0 +35,0 @@ GetLocale = 'get-locale',

@@ -26,2 +26,3 @@ /**

namespace settings {
const all: Promise<any>;
const is4K: Promise<boolean>;

@@ -28,0 +29,0 @@ const transitionType: Promise<TransitionType>;

@@ -38,16 +38,40 @@ /**

const assets = new Assets(bridge);
const settings = new Settings(bridge);
const notifications = new Notifications(bridge);
const appStatus = new AppStatus(bridge);
const playRecorder = new PlayRecorder(bridge);
const social = new Social(bridge);
const events = new PlayerEvents(bridge);
let appStatus = new AppStatus(bridge);
let assets = new Assets(bridge);
let events = new PlayerEvents(bridge);
let notifications = new Notifications(bridge);
let playRecorder = new PlayRecorder(bridge);
let settings = new Settings(bridge);
let social = new Social(bridge);
/**
* Disposes created objects.
*/
function dispose() {
appStatus.dispose();
assets.dispose();
bridge.dispose();
events.dispose();
notifications.dispose();
playRecorder.dispose();
settings.dispose();
social.dispose();
appStatus = null;
assets = null;
bridge = null;
events = null;
notifications = null;
playRecorder = null;
settings = null;
social = null;
}
return {
appStatus,
assets,
dispose,
notifications,
off: events.off.bind(events),
on: events.on.bind(events),
off: events.off.bind(events),
once: events.once.bind(events),

@@ -54,0 +78,0 @@ playRecorder,

@@ -12,2 +12,6 @@ /**

dispose() {
this.bridge = null;
}
post(message: string): Promise<string> {

@@ -14,0 +18,0 @@ return this.bridge.send(Service.Notifications, Action.Post, { message }).then((payload) => {

@@ -14,2 +14,6 @@ /**

dispose() {
this.bridge = null;
}
report(assetId: string, referenceId: any, playDuration: number, additionalInfo: string = '') {

@@ -16,0 +20,0 @@ // The typing lets us add properties dynamically.

@@ -19,2 +19,14 @@ /**

dispose() {
this.bridge = null;
this.version = null;
this.handlerMap.forEach((eventHandlers: Set<any>, eventName: string) => {
eventHandlers.forEach((eventHandler: any) => {
this.off(eventName, eventHandler);
});
eventHandlers = null;
});
this.handlerMap = null;
}
/**

@@ -21,0 +33,0 @@ * Lets apps listen for events. The events are triggered by messages with `service == 'event` coming from the player

@@ -17,2 +17,14 @@ /**

dispose() {
this.bridge = null;
this.version = null;
}
get all(): Promise<any> {
return this.bridge.send(Service.Settings, Action.GetAll).then((payload: any) => {
console.log(`[Enplug SDK: ${this.version}] Settings: Returning all settings: ${payload}`);
return payload;
});
}
get is4K(): Promise<boolean> {

@@ -19,0 +31,0 @@ if (this.is4KCache) {

@@ -11,2 +11,6 @@ /**

dispose() {
this.bridge = null;
}
getItems(): Promise<SocialItem[]> {

@@ -13,0 +17,0 @@ return this.bridge.send(Service.Social, Action.GetItems);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc