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

@internetarchive/lazy-loader-service

Package Overview
Dependencies
Maintainers
9
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internetarchive/lazy-loader-service - npm Package Compare versions

Comparing version 0.0.0-alpha.1 to 0.0.0-alpha.2

10

lib/lazy-loader-service.js

@@ -58,7 +58,17 @@ export var BundleType;

return new Promise((resolve, reject) => {
// if multiple requests get made for this script, just stack the onloads
// and onerrors and all the callbacks will be called in-order of being received
const originalOnLoad = script.onload;
script.onload = (e) => {
if (originalOnLoad) {
originalOnLoad(e);
}
script.setAttribute('dynamicImportLoaded', 'true');
resolve(e);
};
const originalOnError = script.onerror;
script.onerror = (e) => {
if (originalOnError) {
originalOnError(e);
}
/* istanbul ignore else */

@@ -65,0 +75,0 @@ if (script.parentNode) {

2

package.json
{
"name": "@internetarchive/lazy-loader-service",
"version": "0.0.0-alpha.1",
"version": "0.0.0-alpha.2",
"description": "A small library to lazy load javascript with a Promise",

@@ -5,0 +5,0 @@ "license": "AGPL-3.0-only",

@@ -1,2 +0,2 @@

[![Build Status](https://travis-ci.com/internetarchive/iaux-lazy-loader-service.svg?branch=master)](https://travis-ci.com/internetarchive/iaux) [![codecov](https://codecov.io/gh/internetarchive/iaux-lazy-loader-service/branch/master/graph/badge.svg)](https://codecov.io/gh/internetarchive/iaux-lazy-loader-service)
[![Build Status](https://travis-ci.com/internetarchive/iaux-lazy-loader-service.svg?branch=master)](https://travis-ci.com/internetarchive/iaux-lazy-loader-service) [![codecov](https://codecov.io/gh/internetarchive/iaux-lazy-loader-service/branch/master/graph/badge.svg)](https://codecov.io/gh/internetarchive/iaux-lazy-loader-service)

@@ -3,0 +3,0 @@ # Lazy Loader Service

@@ -116,3 +116,9 @@ export enum BundleType {

return new Promise((resolve, reject) => {
// if multiple requests get made for this script, just stack the onloads
// and onerrors and all the callbacks will be called in-order of being received
const originalOnLoad: ((ev: Event) => any) | null = script.onload;
script.onload = (e) => {
if (originalOnLoad) {
originalOnLoad(e);
}
script.setAttribute('dynamicImportLoaded', 'true');

@@ -122,3 +128,8 @@ resolve(e);

const originalOnError: ((error: string | Event) => any) | null = script.onerror;
script.onerror = (e) => {
if (originalOnError) {
originalOnError(e);
}
/* istanbul ignore else */

@@ -125,0 +136,0 @@ if (script.parentNode) {

Sorry, the diff of this file is not supported yet

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