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

simple-load-script

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-load-script - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

es5-umd/simpleLoadScript.js

5

changelog.md
# changelog
## 1.0.3
* update 2do
* update readme
* update dev deps
## 1.0.2

@@ -4,0 +9,0 @@ * added `insertInto` config option

32

package.json
{
"name": "simple-load-script",
"version": "1.0.2",
"version": "1.0.3",
"description": "Very simple promise based script and JSONP",

@@ -14,6 +14,32 @@ "repository": "tomek-f/simple-load-script",

],
"main": "simpleLoadScript.js",
"scripts": {
"prepare": "npm run build",
"makedir": "mkdirp ./es5 && mkdirp ./es5-umd",
"browserify": "browserify es6/simpleLoadScript.js -s simpleLoadScript -t babelify -o es5-umd/simpleLoadScript.js",
"umd": "npm run makedir && npm run browserify",
"es5": "babel es6 --out-dir es5",
"es5-watch": "babel es6 --out-dir es5 --watch",
"umd-watch": "watch-run -i -p 'es6/simpleLoadScript.js' npm run umd",
"build": "npm run umd && npm run es5",
"watch": "npm run umd-watch & npm run es5-watch"
},
"files": [
"es6",
"es5",
"es5-umd"
],
"main": "es5/simpleLoadScript.js",
"author": "Tomek Fijoł <tomekfijol@gmail.com> (http://tomekf.pl/)",
"license": "MIT",
"readmeFilename": "README.md"
"readmeFilename": "README.md",
"devDependencies": {
"@babel/cli": "^7.13.14",
"@babel/core": "^7.13.14",
"@babel/preset-env": "^7.13.12",
"babel-plugin-add-module-exports": "^1.0.4",
"babelify": "^10.0.0",
"browserify": "^17.0.0",
"mkdirp": "^1.0.4",
"watch-run": "^1.2.5"
}
}

80

README.md

@@ -5,3 +5,2 @@ # simple-load-script

* tiny
* Promise based ([use polyfill if you need](http://caniuse.com/#feat=promises))

@@ -16,6 +15,19 @@ * uses addEventListener (IE9+)

## Import
```js
// es5 CommonJS
const loadScript = require('simple-load-script');
// es6
const loadScript = require('simple-load-script/es6/simpleLoadScript');
// es5-umd
const loadScript = require('simple-load-script/es5-umd/simpleLoadScript');
```
## Usage
```js
var loadScript = require('simple-load-script');
import loadScript from 'simple-load-script';

@@ -32,4 +44,14 @@ loadScript('//code.jquery.com/jquery-2.2.3.js')

```js
var loadScript = require('simple-load-script');
import loadScript from 'simple-load-script';
try {
/* const scriptRef = */ loadScript('//code.jquery.com/jquery-2.2.3.js');
} catch (err) {
console.log(err);
}
```
```js
import loadScript from 'simple-load-script';
loadScript('//code.jquery.com/jquery-2.2.3.js', {

@@ -47,3 +69,3 @@ inBody: true

```js
var loadScript = require('simple-load-script');
import loadScript from 'simple-load-script';

@@ -65,3 +87,3 @@ loadScript({

```js
var loadScript = require('simple-load-script');
import loadScript from 'simple-load-script';

@@ -100,3 +122,3 @@ loadScript({

```js
var loadScripts = require('simple-load-script').all;
import loadScript from 'simple-load-script';

@@ -116,6 +138,6 @@ loadScripts(

Load more scripts (Promise.all) - objects and urls, callback must be unique names
Load more scripts (Promise.all) - objects and urls, callBackNames must be unique names
```js
var loadScripts = require('simple-load-script').all;
import loadScript from 'simple-load-script';

@@ -166,46 +188,4 @@ loadScripts(

## UMD (CommonJS, AMD, global, ES6)
### CommonJS
```js
var loadScript = require('simple-load-script');
loadScript(/**/);
```
### AMD
```js
define(['simple-load-script'], function(loadScript) {
loadScript(/**/);
});
```
### Global (in window object)
```js
simpleLoadScript(/**/);
```
### ES6 (ES2015) modules
* loading ES5 module
```js
import loadScript from 'simple-load-script';
loadScript(/**/);
```
## Promise polyfill
Good example
```bash
npm install es6-promise --save
```
## Changelog
[View on github](https://github.com/tomek-f/simple-load-script/blob/master/changelog.md).
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