aboutsummaryrefslogtreecommitdiff
path: root/node_modules/load-script
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/load-script')
-rw-r--r--node_modules/load-script/.npmignore3
-rw-r--r--node_modules/load-script/.zuul.yml12
-rw-r--r--node_modules/load-script/Makefile7
-rw-r--r--node_modules/load-script/Readme.md58
-rw-r--r--node_modules/load-script/component.json11
-rw-r--r--node_modules/load-script/index.js65
-rw-r--r--node_modules/load-script/package.json22
-rw-r--r--node_modules/load-script/test/hello.js1
-rw-r--r--node_modules/load-script/test/index.js90
-rw-r--r--node_modules/load-script/test/throw.js1
10 files changed, 0 insertions, 270 deletions
diff --git a/node_modules/load-script/.npmignore b/node_modules/load-script/.npmignore
deleted file mode 100644
index 665aa219..00000000
--- a/node_modules/load-script/.npmignore
+++ /dev/null
@@ -1,3 +0,0 @@
-components
-build
-node_modules
diff --git a/node_modules/load-script/.zuul.yml b/node_modules/load-script/.zuul.yml
deleted file mode 100644
index 46c25540..00000000
--- a/node_modules/load-script/.zuul.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-ui: mocha-qunit
-browsers:
- - name: chrome
- version: [oldest, latest]
- - name: firefox
- version: [oldest, latest]
- - name: opera
- version: latest
- - name: safari
- version: oldest..latest
- - name: ie
- version: oldest..latest
diff --git a/node_modules/load-script/Makefile b/node_modules/load-script/Makefile
deleted file mode 100644
index 154bf785..00000000
--- a/node_modules/load-script/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-build: index.js
- @component build --dev
-
-clean:
- rm -fr build
-
-.PHONY: clean
diff --git a/node_modules/load-script/Readme.md b/node_modules/load-script/Readme.md
deleted file mode 100644
index 86411052..00000000
--- a/node_modules/load-script/Readme.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# load-script
-
-Dynamic script loading.
-
-## Installation
-
-via component
-
-```
-$ component install eldargab/load-script
-```
-
-via npm
-
-```
-$ npm install load-script
-```
-
-## API
-`load-script` appends a `script` node to the `<head>` element in the dom.
-
-`require('load-script')` returns a function of the following interface: `function(url[, opts][, cb]) {}`
-
-### url
-Any url that you would like to load. May be absolute or relative.
-
-### [, opts]
-A map of options. Here are the currently supported options:
-
-* `async` - A boolean value used for `script.async`. By default this is `true`.
-* `attrs` - A map of attributes to set on the `script` node before appending it to the DOM. By default this is empty.
-* `charset` - A string value used for `script.charset`. By default this is `utf8`.
-* `text` - A string of text to append to the `script` node before it is appended to the DOM. By default this is empty.
-* `type` - A string used for `script.type`. By default this is `text/javascript`.
-
-### [, cb]
-A callback function of the following interface: `function(err, script) {}` where `err` is an error if any occurred and `script` is the `script` node that was appended to the DOM.
-
-## Example Usage
-
-```javascript
-var load = require('load-script')
-
-load('foo.js', function (err, script) {
- if (err) {
- // print useful message
- }
- else {
- console.log(script.src);// Prints 'foo'.js'
- // use script
- // note that in IE8 and below loading error wouldn't be reported
- }
-})
-```
-
-## License
-
-MIT
diff --git a/node_modules/load-script/component.json b/node_modules/load-script/component.json
deleted file mode 100644
index ee7f5612..00000000
--- a/node_modules/load-script/component.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "name": "load-script",
- "repo": "eldargab/load-script",
- "description": "Dynamic script loading",
- "version": "0.0.5",
- "keywords": ["script", "load"],
- "license": "MIT",
- "scripts": [
- "index.js"
- ]
-}
diff --git a/node_modules/load-script/index.js b/node_modules/load-script/index.js
deleted file mode 100644
index 667b9193..00000000
--- a/node_modules/load-script/index.js
+++ /dev/null
@@ -1,65 +0,0 @@
-
-module.exports = function load (src, opts, cb) {
- var head = document.head || document.getElementsByTagName('head')[0]
- var script = document.createElement('script')
-
- if (typeof opts === 'function') {
- cb = opts
- opts = {}
- }
-
- opts = opts || {}
- cb = cb || function() {}
-
- script.type = opts.type || 'text/javascript'
- script.charset = opts.charset || 'utf8';
- script.async = 'async' in opts ? !!opts.async : true
- script.src = src
-
- if (opts.attrs) {
- setAttributes(script, opts.attrs)
- }
-
- if (opts.text) {
- script.text = '' + opts.text
- }
-
- var onend = 'onload' in script ? stdOnEnd : ieOnEnd
- onend(script, cb)
-
- // some good legacy browsers (firefox) fail the 'in' detection above
- // so as a fallback we always set onload
- // old IE will ignore this and new IE will set onload
- if (!script.onload) {
- stdOnEnd(script, cb);
- }
-
- head.appendChild(script)
-}
-
-function setAttributes(script, attrs) {
- for (var attr in attrs) {
- script.setAttribute(attr, attrs[attr]);
- }
-}
-
-function stdOnEnd (script, cb) {
- script.onload = function () {
- this.onerror = this.onload = null
- cb(null, script)
- }
- script.onerror = function () {
- // this.onload = null here is necessary
- // because even IE9 works not like others
- this.onerror = this.onload = null
- cb(new Error('Failed to load ' + this.src), script)
- }
-}
-
-function ieOnEnd (script, cb) {
- script.onreadystatechange = function () {
- if (this.readyState != 'complete' && this.readyState != 'loaded') return
- this.onreadystatechange = null
- cb(null, script) // there is no way to catch loading errors in IE8
- }
-}
diff --git a/node_modules/load-script/package.json b/node_modules/load-script/package.json
deleted file mode 100644
index fccaf3b4..00000000
--- a/node_modules/load-script/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "load-script",
- "description": "Dynamic script loading for browser",
- "version": "1.0.0",
- "keywords": [
- "browser",
- "script",
- "load"
- ],
- "repository": {
- "type": "git",
- "url": "git://github.com/eldargab/load-script"
- },
- "scripts": {
- "test": "zuul -- test/index.js",
- "test-local": "zuul --local 9005 -- test/index.js"
- },
- "devDependencies": {
- "zuul": "~2.1.0"
- },
- "license": "MIT"
-}
diff --git a/node_modules/load-script/test/hello.js b/node_modules/load-script/test/hello.js
deleted file mode 100644
index 77a64c6b..00000000
--- a/node_modules/load-script/test/hello.js
+++ /dev/null
@@ -1 +0,0 @@
-log('Hello world')
diff --git a/node_modules/load-script/test/index.js b/node_modules/load-script/test/index.js
deleted file mode 100644
index a620764b..00000000
--- a/node_modules/load-script/test/index.js
+++ /dev/null
@@ -1,90 +0,0 @@
-var assert = require('assert');
-var load = require('../')
-
-var last_msg = undefined;
-log = function(msg) {
- last_msg = msg;
-}
-
-test('success', function(done) {
- load('test/hello.js', function (err) {
- assert.ifError(err);
- assert.equal(last_msg, 'Hello world');
- last_msg = undefined;
- done();
- })
-});
-
-test('opts.async', function(done) {
- load('test/hello.js', {async: false}, function(err, script) {
- assert.ifError(err);
- assert.equal(script.async, false);
- done();
- })
-});
-
-test('opts.attrs', function(done) {
- load('test/hello.js', {attrs: {foo: 'boo'}}, function(err, script) {
- assert.ifError(err);
- assert.equal(script.getAttribute('foo'), 'boo');
- done();
- })
-});
-
-test('opts.charset', function(done) {
- load('test/hello.js', {charset: 'iso-8859-1'}, function(err, script) {
- assert.ifError(err);
- assert.equal(script.charset, 'iso-8859-1');
- done();
- })
-});
-
-test('opts.text', function(done) {
- load('test/hello.js', {text: 'foo=5;'}, function(err, script) {
- assert.ifError(err);
- done();
- })
-});
-
-test('opts.type', function(done) {
- load('test/hello.js', {type: 'text/ecmascript'}, function(err, script) {
- assert.ifError(err);
- assert.equal(script.type, 'text/ecmascript');
- done();
- })
-});
-
-test('no exist', function(done) {
- load('unexistent.js', function (err, legacy) {
- if (!legacy) {
- assert.ok(err);
- }
-
- var tid = setTimeout(function() {
- done();
- }, 200);
-
- // some browsers will also throw as well as report erro
- var old = window.onerror;
- window.onerror = function(msg, file, line) {
- if (msg !== 'Error loading script') {
- assert(false);
- }
- window.onerror = old;
- clearTimeout(tid);
- done();
- };
- })
-});
-
-test('throw', function(done) {
- var old = window.onerror;
- // silence the script error
- window.onerror = function() {};
- load('test/throw.js', function (err) {
- assert.ifError(err);
- window.onerror = old;
- done();
- })
-});
-
diff --git a/node_modules/load-script/test/throw.js b/node_modules/load-script/test/throw.js
deleted file mode 100644
index a42d606f..00000000
--- a/node_modules/load-script/test/throw.js
+++ /dev/null
@@ -1 +0,0 @@
-throw new Error('Hello error')