Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nlo/ping-video-loader

Package Overview
Dependencies
Maintainers
6
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nlo/ping-video-loader - npm Package Compare versions

Comparing version 0.0.1-alpha.95 to 0.0.1-alpha.124

14

dist/ping-video-loader.d.ts

@@ -11,2 +11,3 @@ declare type WebplayerFunc = (elementId: string | null, widthStyle?: string | null, topStyle?: string | null, videoId?: string | null, scriptName?: string | null, // Extra VARS/HASH for video personalisation

Webplayer?: WebplayerFunc;
loaded?: boolean;
}

@@ -18,12 +19,19 @@ declare global {

$?: any;
pingvpCallback?: () => void;
}
}
declare class PingVideoLoader {
export default class PingVideoLoader {
private scriptId;
private pingVideoPlayerIsLoaded;
private scriptIsCreated;
private videosToLoadBuffer;
constructor(scriptId: string);
loadVideo(elementId: string, videoName: string, autoStart: boolean): Promise<void> | void;
private awaitElementLoad;
private createScriptTag;
private pingVpLoadedCallback;
private setPingVpLoadedCallback;
private webplayerExists;
private loadPingVpAsync;
}
declare const _default: PingVideoLoader;
export default _default;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* Globals PingVP */
var pingVideoPlayerIsLoaded = false;
var scriptIsCreated = false;
var PingVideoLoader = /** @class */ (function () {
function PingVideoLoader() {
function PingVideoLoader(scriptId) {
this.pingVideoPlayerIsLoaded = false;
this.scriptIsCreated = false;
this.videosToLoadBuffer = [];
this.scriptId = scriptId;
}

@@ -30,14 +31,22 @@ PingVideoLoader.prototype.loadVideo = function (elementId, videoName, autoStart) {

PingVideoLoader.prototype.createScriptTag = function () {
if (scriptIsCreated) {
if (this.scriptIsCreated) {
return;
}
// The PingVP script checks for jQuery but uses $, so this ensures that the alias is always set
window.$ = window.jQuery;
var tag = document.createElement('script');
tag.src = 'https://www.pingvp.com/p/aXNejdEHiu';
tag.src = "https://www.pingvp.com/p/" + this.scriptId;
document.body.appendChild(tag);
scriptIsCreated = true;
this.scriptIsCreated = true;
};
PingVideoLoader.prototype.pingVpLoadedCallback = function () {
var _this = this;
this.pingVideoPlayerIsLoaded = true;
this.videosToLoadBuffer.forEach(function (args) { return _this.loadPingVpAsync.apply(_this, args); });
};
PingVideoLoader.prototype.setPingVpLoadedCallback = function () {
if (!window.pingvpCallback) {
window.pingvpCallback = this.pingVpLoadedCallback.bind(this);
}
};
PingVideoLoader.prototype.webplayerExists = function (pingvp) {
return pingVideoPlayerIsLoaded;
return this.pingVideoPlayerIsLoaded;
};

@@ -54,18 +63,8 @@ PingVideoLoader.prototype.loadPingVpAsync = function () {

}
this.setPingVpLoadedCallback();
this.createScriptTag();
var checkPingVp = setInterval(function () {
var _a;
// In reality, this is not exactly the point at which the whole script loading is completed;
// ideally we would get a flag from window.pingvp indicating when the script is properly loaded.
// This does mean that when two PingVP videos are clicked rapidly in succession, the second one
// or both will not be loaded depending on where in the cycle the second video is clicked.
if (window.pingvp && window.pingvp.Webplayer) {
clearInterval(checkPingVp);
(_a = window.pingvp).Webplayer.apply(_a, webplayerArgs);
pingVideoPlayerIsLoaded = true;
}
}, 100);
this.videosToLoadBuffer.push(webplayerArgs);
};
return PingVideoLoader;
}());
exports.default = new PingVideoLoader();
exports.default = PingVideoLoader;
{
"name": "@nlo/ping-video-loader",
"version": "0.0.1-alpha.95+3b5729b",
"version": "0.0.1-alpha.124+31c427b",
"description": "",

@@ -13,3 +13,3 @@ "main": "dist/index.js",

"scripts": {
"tsc": "tsc --build",
"build": "tsc --build",
"watch": "tsc --watch"

@@ -24,3 +24,3 @@ },

},
"gitHead": "3b5729bd38c9905bed5e0543bcecb322a246836a"
"gitHead": "31c427b6e4b9e1c0b6446f192f597b91f6f1af27"
}
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