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

vue-script2

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-script2 - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

10

dist/vue-script2.js
/*!
* vue-script2 v2.0.0
* (c) 2016 Greg Slepak
* vue-script2 v2.0.1
* (c) 2016-2017 Greg Slepak
* @license MIT License

@@ -15,3 +15,3 @@ */

p: Promise.resolve(),
version: '2.0.0', // grunt will overwrite to match package.json
version: '2.0.1', // grunt will overwrite to match package.json
loaded: {}, // keys are the scripts that have been loaded

@@ -85,3 +85,5 @@ install: function install(Vue) {

// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-crossorigin
s.crossOrigin = opts.crossorigin;
if (opts.crossorigin) {
s.crossOrigin = opts.crossorigin;
}
// inspiration from: https://github.com/eldargab/load-script/blob/master/index.js

@@ -88,0 +90,0 @@ // and: https://github.com/ded/script.js/blob/master/src/script.js#L70-L82

6

dist/vue-script2.min.js
/*!
* vue-script2 v2.0.0
* (c) 2016 Greg Slepak
* vue-script2 v2.0.1
* (c) 2016-2017 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:"2.0.0",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>',mounted:function(){var t=this,i=this.$el.parentElement;if(this.src){var r=n.omitBy(n.pick(this,o),n.isUndefined);r.parent=i;var c=function(){return e.load(t.src,r)};n.isUndefined(this.async)?e.p=e.p.then(c):c()}else e.p=e.p.then(function(){var e=document.createElement("script");e.type="text/javascript",e.appendChild(document.createTextNode(t.$el.innerHTML)),i.appendChild(e)});this.$nextTick(function(){t.$el.remove()})},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});
!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:"2.0.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>',mounted:function(){var t=this,i=this.$el.parentElement;if(this.src){var r=n.omitBy(n.pick(this,o),n.isUndefined);r.parent=i;var c=function(){return e.load(t.src,r)};n.isUndefined(this.async)?e.p=e.p.then(c):c()}else e.p=e.p.then(function(){var e=document.createElement("script");e.type="text/javascript",e.appendChild(document.createTextNode(t.$el.innerHTML)),i.appendChild(e)});this.$nextTick(function(){t.$el.remove()})},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,i.crossorigin&&(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": "2.0.0",
"version": "2.0.1",
"description": "Brings back <script> to your favorite Single Page App!",

@@ -5,0 +5,0 @@ "main": "dist/vue-script2.js",

@@ -138,2 +138,3 @@ # VueScript2 - Simple, Familiar Asynchronous Script Loading

- __2.0.1__ - `crossorigin` Safari fix (thanks [@mingchuno](https://github.com/mingchuno)!)
- __2.0.0__ - Vue 2.x compatible. Requires Vue 2.x. Use 1.2.2 for Vue 1.x.

@@ -140,0 +141,0 @@ - __1.2.2__ - Fixes broken `crossorigin` attribute (thx @grempe!)

var Script2 = {
installed: false,
p: Promise.resolve(),
version: '2.0.0', // grunt will overwrite to match package.json
version: '2.0.1', // grunt will overwrite to match package.json
loaded: {}, // keys are the scripts that have been loaded

@@ -67,3 +67,5 @@ install (Vue, options = {}) {

// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-crossorigin
s.crossOrigin = opts.crossorigin
if (opts.crossorigin) {
s.crossOrigin = opts.crossorigin
}
// inspiration from: https://github.com/eldargab/load-script/blob/master/index.js

@@ -70,0 +72,0 @@ // and: https://github.com/ded/script.js/blob/master/src/script.js#L70-L82

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