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 1.2.2 to 2.0.0

14

dist/vue-script2.js
/*!
* vue-script2 v1.2.2
* vue-script2 v2.0.0
* (c) 2016 Greg Slepak

@@ -15,3 +15,3 @@ * @license MIT License

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

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

template: '<div style="display:none"><slot></slot></div>',
ready: function ready() {
// NOTE: I tried doing this with Vue 2's new render() function.
// It was a nightmare and I never got it to work.
mounted: function mounted() {
var _this = this;

@@ -54,3 +56,7 @@

}
Vue.util.remove(this.$el); // remove dummy template <div>
// see: https://vuejs.org/v2/guide/migration.html#ready-replaced
this.$nextTick(function () {
// code that assumes this.$el is in-document
_this.$el.remove(); // remove dummy template <div>
});
},

@@ -57,0 +63,0 @@ destroyed: function destroyed() {

/*!
* vue-script2 v1.2.2
* vue-script2 v2.0.0
* (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.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});
!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});
{
"name": "vue-script2",
"version": "1.2.2",
"version": "2.0.0",
"description": "Brings back <script> to your favorite Single Page App!",

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

@@ -11,2 +11,4 @@ # VueScript2 - Simple, Familiar Asynchronous Script Loading

***NOTE:*** _Requires Vue 2.x. Use version 1.2.2 for Vue 1.x._
## Features

@@ -25,4 +27,2 @@

Oh, and it's easy to modify this library to also support imperative loading of
## Installation

@@ -140,2 +140,3 @@

- __2.0.0__ - Vue 2.x compatible. Requires Vue 2.x. Use 1.2.2 for Vue 1.x.
- __1.2.2__ - Fixes broken `crossorigin` attribute (thx @grempe!)

@@ -142,0 +143,0 @@ - __1.2.1__ - Just a bit of perfectionism to fix a non-issue issue

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

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

template: '<div style="display:none"><slot></slot></div>',
ready () {
// NOTE: I tried doing this with Vue 2's new render() function.
// It was a nightmare and I never got it to work.
mounted () {
var parent = this.$el.parentElement

@@ -37,3 +39,7 @@ if (!this.src) {

}
Vue.util.remove(this.$el) // remove dummy template <div>
// see: https://vuejs.org/v2/guide/migration.html#ready-replaced
this.$nextTick(() => {
// code that assumes this.$el is in-document
this.$el.remove() // remove dummy template <div>
})
},

@@ -40,0 +46,0 @@ destroyed () {

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