New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vxe-ajax

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vxe-ajax - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

45

dist/vxe-ajax.js
/*!
* vxe-ajax.js v1.3.3
* vxe-ajax.js v1.3.4
* (c) 2017-2018 Xu Liangzhan

@@ -11,5 +11,46 @@ * ISC License.

function plugin (Vue, XEAjax) {
function bindPromiseContext (callback) {
return typeof callback === 'function' ? callback.bind(this.context) : callback
}
function XEPromise (executor, context) {
if (executor instanceof Promise) {
this.promise = executor
} else {
this.promise = new Promise(executor.bind(context))
}
this.context = context
}
XEPromise.prototype.then = function (resolve, reject) {
return new XEPromise(this.promise.then(bindPromiseContext.call(this, resolve), bindPromiseContext.call(this, reject)), this.context)
}
XEPromise.prototype.catch = function (reject) {
return new XEPromise(this.promise.catch(bindPromiseContext.call(this, reject)), this.context)
}
XEPromise.all = function (iterable, context) {
return new XEPromise(Promise.all(iterable), context)
}
XEPromise.race = function (reason, context) {
return new XEPromise(Promise.race(reason), context)
}
XEPromise.resolve = function (reason, context) {
return new XEPromise(Promise.resolve(reason), context)
}
XEPromise.reject = function (reason, context) {
return new XEPromise(Promise.reject(reason), context)
}
function plugin (Vue, XEAjax, isContext) {
if (isContext === true && XEAjax.$p) {
XEAjax.$p(XEPromise)
}
Object.defineProperty(Vue.prototype, '$ajax', {
get: function () {
XEAjax.context = this
return XEAjax

@@ -16,0 +57,0 @@ }

4

dist/vxe-ajax.min.js
/*!
* vxe-ajax.js v1.3.3
* vxe-ajax.js v1.3.4
* (c) 2017-2018 Xu Liangzhan
* ISC License.
*/
(function(b,a){typeof exports==="object"&&typeof module!=="undefined"?module.exports=a():typeof define==="function"&&define.amd?define(a):(b.VXEAjax=a())}(this,function(){function a(c,b){Object.defineProperty(c.prototype,"$ajax",{get:function(){return b}})}return a}));
(function(b,a){typeof exports==="object"&&typeof module!=="undefined"?module.exports=a():typeof define==="function"&&define.amd?define(a):(b.VXEAjax=a())}(this,function(){function b(d){return typeof d==="function"?d.bind(this.context):d}function c(e,d){if(e instanceof Promise){this.promise=e}else{this.promise=new Promise(e.bind(d))}this.context=d}c.prototype.then=function(e,d){return new c(this.promise.then(b.call(this,e),b.call(this,d)),this.context)};c.prototype.catch=function(d){return new c(this.promise.catch(b.call(this,d)),this.context)};c.all=function(e,d){return new c(Promise.all(e),d)};c.race=function(e,d){return new c(Promise.race(e),d)};c.resolve=function(e,d){return new c(Promise.resolve(e),d)};c.reject=function(e,d){return new c(Promise.reject(e),d)};function a(f,d,e){if(e===true&&d.$p){d.$p(c)}Object.defineProperty(f.prototype,"$ajax",{get:function(){d.context=this;return d}})}return a}));

@@ -1,4 +0,45 @@

function plugin (Vue, XEAjax) {
function bindPromiseContext (callback) {
return typeof callback === 'function' ? callback.bind(this.context) : callback
}
function XEPromise (executor, context) {
if (executor instanceof Promise) {
this.promise = executor
} else {
this.promise = new Promise(executor.bind(context))
}
this.context = context
}
XEPromise.prototype.then = function (resolve, reject) {
return new XEPromise(this.promise.then(bindPromiseContext.call(this, resolve), bindPromiseContext.call(this, reject)), this.context)
}
XEPromise.prototype.catch = function (reject) {
return new XEPromise(this.promise.catch(bindPromiseContext.call(this, reject)), this.context)
}
XEPromise.all = function (iterable, context) {
return new XEPromise(Promise.all(iterable), context)
}
XEPromise.race = function (reason, context) {
return new XEPromise(Promise.race(reason), context)
}
XEPromise.resolve = function (reason, context) {
return new XEPromise(Promise.resolve(reason), context)
}
XEPromise.reject = function (reason, context) {
return new XEPromise(Promise.reject(reason), context)
}
function plugin (Vue, XEAjax, isContext) {
if (isContext === true && XEAjax.$p) {
XEAjax.$p(XEPromise)
}
Object.defineProperty(Vue.prototype, '$ajax', {
get: function () {
XEAjax.context = this
return XEAjax

@@ -5,0 +46,0 @@ }

{
"name": "vxe-ajax",
"version": "1.3.3",
"version": "1.3.4",
"description": "VXEAjax 用于Vue全局安装 xe-ajax",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -34,3 +34,5 @@ # VXEAjax 用于Vue全局安装 xe-ajax

define(['vue', 'xe-ajax', 'vxe-ajax'], function (Vue, XEAjax, VXEAjax) {
Vue.use(VXEAjax, XEAjax)
// (v1.3.4+)如果第三个参数设置为true,则启动模拟 Promise 模式(默认是false)
// 通过 this.$ajax 发起的请求 this 默认指向当前vue实例。
Vue.use(VXEAjax, XEAjax, true)
})

@@ -42,3 +44,5 @@

// ...vue代码省略
this.$ajax.getJSON('/api/user/list', {id: 1})
this.$ajax.getJSON('/api/user/list', {id: 1}).then(data => {
this.list = [] // (v1.3.4+)需要启动模拟 Promise 模式才支持 this 默认指向 vue 实例
})
})

@@ -45,0 +49,0 @@ ```

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