vue-script2
Advanced tools
Comparing version 1.2.1 to 1.2.2
/*! | ||
* vue-script2 v1.2.1 | ||
* vue-script2 v1.2.2 | ||
* (c) 2016 Greg Slepak | ||
@@ -15,3 +15,3 @@ * @license MIT License | ||
p: Promise.resolve(), | ||
version: '1.2.1', // grunt will overwrite to match package.json | ||
version: '1.2.2', // grunt will overwrite to match package.json | ||
loaded: {}, // keys are the scripts that have been loaded | ||
@@ -77,2 +77,5 @@ install: function install(Vue) { | ||
s.src = src; | ||
// crossorigin in HTML and crossOrigin in the DOM per HTML spec | ||
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-crossorigin | ||
s.crossOrigin = opts.crossorigin; | ||
// inspiration from: https://github.com/eldargab/load-script/blob/master/index.js | ||
@@ -79,0 +82,0 @@ // and: https://github.com/ded/script.js/blob/master/src/script.js#L70-L82 |
/*! | ||
* vue-script2 v1.2.1 | ||
* vue-script2 v1.2.2 | ||
* (c) 2016 Greg Slepak | ||
* @license MIT License | ||
*/ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.VueScript2=n()}(this,function(){"use strict";var e={installed:!1,p:Promise.resolve(),version:"1.2.1",loaded:{},install:function(t){arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(!e.installed){var i=["unload"],o=i.concat(["src","type","async","integrity","text","crossorigin"]);t.component("script2",{props:o,template:'<div style="display:none"><slot></slot></div>',ready:function(){var i=this,r=this.$el.parentElement;if(this.src){var c=n.omitBy(n.pick(this,o),n.isUndefined);c.parent=r;var a=function(){return e.load(i.src,c)};n.isUndefined(this.async)?e.p=e.p.then(a):a()}else e.p=e.p.then(function(){var e=document.createElement("script");e.type="text/javascript",e.appendChild(document.createTextNode(i.$el.innerHTML)),r.appendChild(e)});t.util.remove(this.$el)},destroyed:function(){this.unload&&(new Function(this.unload)(),delete e.loaded[this.src])}}),e.installed=!0}},load:function(t){var i=arguments.length<=1||void 0===arguments[1]?{parent:document.head}:arguments[1];return e.loaded[t]?Promise.resolve(t):new Promise(function(o,r){var c=document.createElement("script");n.defaults2(c,n.omit(i,["unload","parent"]),{type:"text/javascript"}),c.async=!1,c.src=t,c.onload=function(){e.loaded[t]=1,o(t)},c.onerror=function(){return r(new Error(t))},i.parent.appendChild(c)})}},n={isUndefined:function(e){return void 0===e},pick:function(e,n){var t={};return n.forEach(function(n){return t[n]=e[n]}),t},omit:function(e,n){var t={};return Object.keys(e).forEach(function(i){-1===n.indexOf(i)&&(t[i]=e[i])}),t},omitBy:function(e,n){var t={};return Object.keys(e).forEach(function(i){n(e[i])||(t[i]=e[i])}),t},defaults2:function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;t>o;o++)i[o-1]=arguments[o];i.forEach(function(t){Object.keys(t).forEach(function(i){(n.isUndefined(e[i])||""===e[i])&&(e[i]=t[i])})})}};return e}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.VueScript2=n()}(this,function(){"use strict";var e={installed:!1,p:Promise.resolve(),version:"1.2.2",loaded:{},install:function(t){arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(!e.installed){var i=["unload"],o=i.concat(["src","type","async","integrity","text","crossorigin"]);t.component("script2",{props:o,template:'<div style="display:none"><slot></slot></div>',ready:function(){var i=this,r=this.$el.parentElement;if(this.src){var c=n.omitBy(n.pick(this,o),n.isUndefined);c.parent=r;var a=function(){return e.load(i.src,c)};n.isUndefined(this.async)?e.p=e.p.then(a):a()}else e.p=e.p.then(function(){var e=document.createElement("script");e.type="text/javascript",e.appendChild(document.createTextNode(i.$el.innerHTML)),r.appendChild(e)});t.util.remove(this.$el)},destroyed:function(){this.unload&&(new Function(this.unload)(),delete e.loaded[this.src])}}),e.installed=!0}},load:function(t){var i=arguments.length<=1||void 0===arguments[1]?{parent:document.head}:arguments[1];return e.loaded[t]?Promise.resolve(t):new Promise(function(o,r){var c=document.createElement("script");n.defaults2(c,n.omit(i,["unload","parent"]),{type:"text/javascript"}),c.async=!1,c.src=t,c.crossOrigin=i.crossorigin,c.onload=function(){e.loaded[t]=1,o(t)},c.onerror=function(){return r(new Error(t))},i.parent.appendChild(c)})}},n={isUndefined:function(e){return void 0===e},pick:function(e,n){var t={};return n.forEach(function(n){return t[n]=e[n]}),t},omit:function(e,n){var t={};return Object.keys(e).forEach(function(i){-1===n.indexOf(i)&&(t[i]=e[i])}),t},omitBy:function(e,n){var t={};return Object.keys(e).forEach(function(i){n(e[i])||(t[i]=e[i])}),t},defaults2:function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;t>o;o++)i[o-1]=arguments[o];i.forEach(function(t){Object.keys(t).forEach(function(i){(n.isUndefined(e[i])||""===e[i])&&(e[i]=t[i])})})}};return e}); |
{ | ||
"name": "vue-script2", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Brings back <script> to your favorite Single Page App!", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-script2.js", |
@@ -24,3 +24,3 @@ # VueScript2 - Simple, Familiar Asynchronous Script Loading | ||
Oh, and it's easy to modify this library to also support imperative loading of | ||
Oh, and it's easy to modify this library to also support imperative loading of | ||
@@ -139,2 +139,3 @@ ## Installation | ||
- __1.2.2__ - Fixes broken `crossorigin` attribute (thx @grempe!) | ||
- __1.2.1__ - Just a bit of perfectionism to fix a non-issue issue | ||
@@ -141,0 +142,0 @@ - __1.2.0__ - Added `VueScript2.load` imperative loading |
var Script2 = { | ||
installed: false, | ||
p: Promise.resolve(), | ||
version: '1.2.1', // grunt will overwrite to match package.json | ||
version: '1.2.2', // grunt will overwrite to match package.json | ||
loaded: {}, // keys are the scripts that have been loaded | ||
@@ -59,2 +59,5 @@ install (Vue, options = {}) { | ||
s.src = src | ||
// crossorigin in HTML and crossOrigin in the DOM per HTML spec | ||
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-crossorigin | ||
s.crossOrigin = opts.crossorigin | ||
// inspiration from: https://github.com/eldargab/load-script/blob/master/index.js | ||
@@ -61,0 +64,0 @@ // and: https://github.com/ded/script.js/blob/master/src/script.js#L70-L82 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20500
283
149