vue-resource
Advanced tools
Comparing version 0.1.9 to 0.1.10
/** | ||
* vue-resource v0.1.9 | ||
* vue-resource v0.1.10 | ||
* https://github.com/vuejs/vue-resource | ||
@@ -362,3 +362,3 @@ * Released under the MIT License. | ||
options = _.extend(true, {url: url}, | ||
Http.options, _.options('http', this, options) | ||
Http.options, _.options('http', self, options) | ||
); | ||
@@ -382,3 +382,3 @@ | ||
if (options.emulateHTTP && !option.crossOrigin && /^(put|patch|delete)$/i.test(options.method)) { | ||
if (options.emulateHTTP && !options.crossOrigin && /^(put|patch|delete)$/i.test(options.method)) { | ||
options.headers['X-HTTP-Method-Override'] = options.method; | ||
@@ -401,3 +401,3 @@ options.method = 'post'; | ||
promise = (options.method.toLowerCase() == 'jsonp' ? jsonp : xhr).call(this, this.$url || Url, options); | ||
promise = (options.method.toLowerCase() == 'jsonp' ? jsonp : xhr).call(self, self.$url || Url, options); | ||
@@ -571,5 +571,9 @@ promise.then(transformResponse, transformResponse); | ||
var RESOLVED = 0; | ||
var REJECTED = 1; | ||
var PENDING = 2; | ||
function Promise(executor) { | ||
this.state = Promise.State.PENDING; | ||
this.state = PENDING; | ||
this.value = undefined; | ||
@@ -591,8 +595,2 @@ this.deferred = []; | ||
Promise.State = { | ||
RESOLVED: 0, | ||
REJECTED: 1, | ||
PENDING: 2 | ||
}; | ||
Promise.reject = function (r) { | ||
@@ -649,3 +647,3 @@ return new Promise(function (resolve, reject) { | ||
if (promise.state === Promise.State.PENDING) { | ||
if (promise.state === PENDING) { | ||
if (x === promise) { | ||
@@ -681,3 +679,3 @@ throw new TypeError('Promise settled with itself.'); | ||
} | ||
promise.state = Promise.State.RESOLVED; | ||
promise.state = RESOLVED; | ||
promise.value = x; | ||
@@ -691,3 +689,3 @@ promise.notify(); | ||
if (promise.state === Promise.State.PENDING) { | ||
if (promise.state === PENDING) { | ||
if (reason === promise) { | ||
@@ -697,3 +695,3 @@ throw new TypeError('Promise settled with itself.'); | ||
promise.state = Promise.State.REJECTED; | ||
promise.state = REJECTED; | ||
promise.value = reason; | ||
@@ -708,3 +706,3 @@ promise.notify(); | ||
async(function () { | ||
if (promise.state !== Promise.State.PENDING) { | ||
if (promise.state !== PENDING) { | ||
while (promise.deferred.length) { | ||
@@ -718,3 +716,3 @@ var deferred = promise.deferred.shift(), | ||
try { | ||
if (promise.state === Promise.State.RESOLVED) { | ||
if (promise.state === RESOLVED) { | ||
if (typeof onResolved === 'function') { | ||
@@ -725,3 +723,3 @@ resolve(onResolved.call(undefined, promise.value)); | ||
} | ||
} else if (promise.state === Promise.State.REJECTED) { | ||
} else if (promise.state === REJECTED) { | ||
if (typeof onRejected === 'function') { | ||
@@ -728,0 +726,0 @@ resolve(onRejected.call(undefined, promise.value)); |
/** | ||
* vue-resource v0.1.9 | ||
* vue-resource v0.1.10 | ||
* https://github.com/vuejs/vue-resource | ||
@@ -7,2 +7,2 @@ * Released under the MIT License. | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.VueResource=e():t.VueResource=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){function r(t){t.url=n(1)(t),t.http=n(3)(t),t.resource=n(7)(t)}window.Vue&&Vue.use(r),t.exports=r},function(t,e,n){var r=n(2),o=document.createElement("a");t.exports=function(t){function e(t,n){var o,i={},s={},c=t;return r.isPlainObject(c)||(c={url:t,params:n}),c=r.extend({},e.options,r.options("url",this,c)),t=c.url.replace(/:([a-z]\w*)/gi,function(t,e){return c.params[e]?(i[e]=!0,a(c.params[e])):""}),"string"!=typeof c.root||t.match(/^(https?:)?\//)||(t=c.root+"/"+t),t=t.replace(/([^:])[\/]{2,}/g,"$1/"),t=t.replace(/(\w+)\/+$/,"$1"),r.each(c.params,function(t,e){i[e]||(s[e]=t)}),o=e.params(s),o&&(t+=(-1==t.indexOf("?")?"?":"&")+o),t}function n(t,e,o){var a,i=r.isArray(e),s=r.isPlainObject(e);r.each(e,function(e,c){a=r.isObject(e)||r.isArray(e),o&&(c=o+"["+(s||a?c:"")+"]"),!o&&i?t.add(e.name,e.value):a?n(t,e,c):t.add(c,e)})}function a(t){return i(t,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function i(t,e){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,e?"%20":"+")}return e.options={url:"",params:{}},e.params=function(t){var e=[];return e.add=function(t,e){r.isFunction(e)&&(e=e()),null===e&&(e=""),this.push(a(t)+"="+a(e))},n(e,t),e.join("&")},e.parse=function(t){return o.href=t,{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",port:o.port,host:o.host,hostname:o.hostname,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):""}},Object.defineProperty(t.prototype,"$url",{get:function(){return r.extend(e.bind(this),e)}}),e}},function(t,e){function n(t,e,o){for(var a in e)o&&(r.isPlainObject(e[a])||r.isArray(e[a]))?(r.isPlainObject(e[a])&&!r.isPlainObject(t[a])&&(t[a]={}),r.isArray(e[a])&&!r.isArray(t[a])&&(t[a]=[]),n(t[a],e[a],o)):void 0!==e[a]&&(t[a]=e[a])}var r=e;r.isArray=Array.isArray,r.isFunction=function(t){return t&&"function"==typeof t},r.isObject=function(t){return null!==t&&"object"==typeof t},r.isPlainObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},r.options=function(t,e,n){var o=e.$options||{};return r.extend({},o[t],n)},r.each=function(t,e){var n,o;if("number"==typeof t.length)for(n=0;n<t.length;n++)e.call(t[n],t[n],n);else if(r.isObject(t))for(o in t)t.hasOwnProperty(o)&&e.call(t[o],t[o],o);return t},r.extend=function(t){var e,r=[],o=r.slice.call(arguments,1);return"boolean"==typeof t&&(e=t,t=o.shift()),o.forEach(function(r){n(t,r,e)}),t}},function(t,e,n){var r=n(2),o=n(4),a=n(6),i={"Content-Type":"application/json;charset=utf-8"};t.exports=function(t){function e(t,i){var u,f=this;return i=i||{},r.isPlainObject(t)&&(i=t,t=""),i=r.extend(!0,{url:t},e.options,r.options("http",this,i)),null===i.crossOrigin&&(i.crossOrigin=s(i.url)),i.headers=r.extend({},e.headers.common,i.crossOrigin?{}:e.headers.custom,e.headers[i.method.toLowerCase()],i.headers),r.isPlainObject(i.data)&&/^(get|jsonp)$/i.test(i.method)&&(r.extend(i.params,i.data),delete i.data),i.emulateHTTP&&!option.crossOrigin&&/^(put|patch|delete)$/i.test(i.method)&&(i.headers["X-HTTP-Method-Override"]=i.method,i.method="post"),i.emulateJSON&&r.isPlainObject(i.data)&&(i.headers["Content-Type"]="application/x-www-form-urlencoded",i.data=c.params(i.data)),r.isObject(i.data)&&/FormData/i.test(i.data.toString())&&delete i.headers["Content-Type"],r.isPlainObject(i.data)&&(i.data=JSON.stringify(i.data)),u=("jsonp"==i.method.toLowerCase()?a:o).call(this,this.$url||c,i),u.then(n,n),u.success=function(t){return u.then(function(e){t.call(f,e.data,e.status,e)},function(){}),u},u.error=function(t){return u["catch"](function(e){t.call(f,e.data,e.status,e)}),u},u.always=function(t){var e=function(e){t.call(f,e.data,e.status,e)};return u.then(e,e),u},i.success&&u.success(i.success),i.error&&u.error(i.error),u}function n(t){try{t.data=JSON.parse(t.responseText)}catch(e){t.data=t.responseText}}function s(t){var e=c.parse(t);return e.protocol!==u.protocol||e.host!==u.host}var c=t.url,u=c.parse(location.href);return e.options={method:"get",params:{},data:"",jsonp:"callback",beforeSend:null,crossOrigin:null,emulateHTTP:!1,emulateJSON:!1},e.headers={put:i,post:i,patch:i,"delete":i,common:{Accept:"application/json, text/plain, */*"},custom:{"X-Requested-With":"XMLHttpRequest"}},["get","put","post","patch","delete","jsonp"].forEach(function(t){e[t]=function(e,n,o,a){return r.isFunction(n)&&(a=o,o=n,n=void 0),this(e,r.extend({method:t,data:n,success:o},a))}}),Object.defineProperty(t.prototype,"$http",{get:function(){return r.extend(e.bind(this),e)}}),e}},function(t,e,n){var r=n(2),o=n(5);t.exports=function(t,e){var n,a=new XMLHttpRequest;return r.isFunction(e.beforeSend)&&e.beforeSend.call(this,a,e),n=new o(function(n,o){a.open(e.method,t(e),!0),r.each(e.headers,function(t,e){a.setRequestHeader(e,t)}),a.onreadystatechange=function(){4===this.readyState&&(this.status>=200&&this.status<300?n(this):o(this))},a.send(e.data)}),r.extend(n,{abort:function(){a.abort()}}),n}},function(t,e){function n(t){this.state=n.State.PENDING,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(r){e.reject(r)}}n.State={RESOLVED:0,REJECTED:1,PENDING:2},n.reject=function(t){return new n(function(e,n){n(t)})},n.resolve=function(t){return new n(function(e,n){e(t)})},n.all=function(t){return new n(function(e,n){function r(n){return function(r){a[n]=r,o+=1,o===t.length&&e(a)}}var o=0,a=[];0===t.length&&e(a);for(var i=0;i<t.length;i+=1)t[i].then(r(i),n)})},n.race=function(t){return new n(function(e,n){for(var r=0;r<t.length;r+=1)t[r].then(e,n)})};var r=n.prototype;r.resolve=function(t){var e=this;if(e.state===n.State.PENDING){if(t===e)throw new TypeError("Promise settled with itself.");var r=!1;try{var o=t&&t.then;if(null!==t&&"object"==typeof t&&"function"==typeof o)return void o.call(t,function(t){r||e.resolve(t),r=!0},function(t){r||e.reject(t),r=!0})}catch(a){return void(r||e.reject(a))}e.state=n.State.RESOLVED,e.value=t,e.notify()}},r.reject=function(t){var e=this;if(e.state===n.State.PENDING){if(t===e)throw new TypeError("Promise settled with itself.");e.state=n.State.REJECTED,e.value=t,e.notify()}},r.notify=function(){var t=this;a(function(){if(t.state!==n.State.PENDING)for(;t.deferred.length;){var e=t.deferred.shift(),r=e[0],o=e[1],a=e[2],i=e[3];try{t.state===n.State.RESOLVED?a("function"==typeof r?r.call(void 0,t.value):t.value):t.state===n.State.REJECTED&&("function"==typeof o?a(o.call(void 0,t.value)):i(t.value))}catch(s){i(s)}}})},r["catch"]=function(t){return this.then(void 0,t)},r.then=function(t,e){var r=this;return new n(function(n,o){r.deferred.push([t,e,n,o]),r.notify()})};var o=[],a=function(t){o.push(t),1===o.length&&a.async()};if(a.run=function(){for(;o.length;)o[0](),o.shift()},window.MutationObserver){var i=document.createElement("div"),s=new MutationObserver(a.run);s.observe(i,{attributes:!0}),a.async=function(){i.setAttribute("x",0)}}else a.async=function(){setTimeout(a.run)};t.exports=window.Promise||n},function(t,e,n){var r=n(2),o=n(5);t.exports=function(t,e){var n,a,i="_jsonp"+Math.random().toString(36).substr(2);return e.params[e.jsonp]=i,r.isFunction(e.beforeSend)&&e.beforeSend.call(this,{},e),new o(function(r,o){n=document.createElement("script"),n.src=t(e.url,e.params),n.type="text/javascript",n.async=!0,window[i]=function(t){a=t};var s=function(t){delete window[i],document.body.removeChild(n),"load"!==t.type||a||(t.type="error");var e=a?a:t.type,s="error"===t.type?404:200;(200===s?r:o)({responseText:e,status:s})};n.onload=s,n.onerror=s,document.body.appendChild(n)})}},function(t,e,n){var r=n(2);t.exports=function(t){function e(o,a,i){var s=this,c={};return i=r.extend({},e.actions,i),r.each(i,function(e,i){e=r.extend(!0,{url:o,params:a||{}},e),c[i]=function(){return(s.$http||t.http)(n(e,arguments))}}),c}function n(t,e){var n,o,a,i=r.extend({},t),s={};switch(e.length){case 4:a=e[3],o=e[2];case 3:case 2:if(!r.isFunction(e[1])){s=e[0],n=e[1],o=e[2];break}if(r.isFunction(e[0])){o=e[0],a=e[1];break}o=e[1],a=e[2];case 1:r.isFunction(e[0])?o=e[0]:/^(post|put|patch)$/i.test(i.method)?n=e[0]:s=e[0];break;case 0:break;default:throw"Expected up to 4 arguments [params, data, success, error], got "+e.length+" arguments"}return i.url=t.url,i.data=n,i.params=r.extend({},t.params,s),o&&(i.success=o),a&&(i.error=a),i}return e.actions={get:{method:"get"},save:{method:"post"},query:{method:"get"},remove:{method:"delete"},"delete":{method:"delete"}},Object.defineProperty(t.prototype,"$resource",{get:function(){return e.bind(this)}}),e}}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.VueResource=e():t.VueResource=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){function r(t){t.url=n(1)(t),t.http=n(3)(t),t.resource=n(7)(t)}window.Vue&&Vue.use(r),t.exports=r},function(t,e,n){var r=n(2),o=document.createElement("a");t.exports=function(t){function e(t,n){var o,i={},s={},c=t;return r.isPlainObject(c)||(c={url:t,params:n}),c=r.extend({},e.options,r.options("url",this,c)),t=c.url.replace(/:([a-z]\w*)/gi,function(t,e){return c.params[e]?(i[e]=!0,a(c.params[e])):""}),"string"!=typeof c.root||t.match(/^(https?:)?\//)||(t=c.root+"/"+t),t=t.replace(/([^:])[\/]{2,}/g,"$1/"),t=t.replace(/(\w+)\/+$/,"$1"),r.each(c.params,function(t,e){i[e]||(s[e]=t)}),o=e.params(s),o&&(t+=(-1==t.indexOf("?")?"?":"&")+o),t}function n(t,e,o){var a,i=r.isArray(e),s=r.isPlainObject(e);r.each(e,function(e,c){a=r.isObject(e)||r.isArray(e),o&&(c=o+"["+(s||a?c:"")+"]"),!o&&i?t.add(e.name,e.value):a?n(t,e,c):t.add(c,e)})}function a(t){return i(t,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function i(t,e){return encodeURIComponent(t).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,e?"%20":"+")}return e.options={url:"",params:{}},e.params=function(t){var e=[];return e.add=function(t,e){r.isFunction(e)&&(e=e()),null===e&&(e=""),this.push(a(t)+"="+a(e))},n(e,t),e.join("&")},e.parse=function(t){return o.href=t,{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",port:o.port,host:o.host,hostname:o.hostname,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):""}},Object.defineProperty(t.prototype,"$url",{get:function(){return r.extend(e.bind(this),e)}}),e}},function(t,e){function n(t,e,o){for(var a in e)o&&(r.isPlainObject(e[a])||r.isArray(e[a]))?(r.isPlainObject(e[a])&&!r.isPlainObject(t[a])&&(t[a]={}),r.isArray(e[a])&&!r.isArray(t[a])&&(t[a]=[]),n(t[a],e[a],o)):void 0!==e[a]&&(t[a]=e[a])}var r=e;r.isArray=Array.isArray,r.isFunction=function(t){return t&&"function"==typeof t},r.isObject=function(t){return null!==t&&"object"==typeof t},r.isPlainObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},r.options=function(t,e,n){var o=e.$options||{};return r.extend({},o[t],n)},r.each=function(t,e){var n,o;if("number"==typeof t.length)for(n=0;n<t.length;n++)e.call(t[n],t[n],n);else if(r.isObject(t))for(o in t)t.hasOwnProperty(o)&&e.call(t[o],t[o],o);return t},r.extend=function(t){var e,r=[],o=r.slice.call(arguments,1);return"boolean"==typeof t&&(e=t,t=o.shift()),o.forEach(function(r){n(t,r,e)}),t}},function(t,e,n){var r=n(2),o=n(4),a=n(6),i={"Content-Type":"application/json;charset=utf-8"};t.exports=function(t){function e(t,i){var u,f=this;return i=i||{},r.isPlainObject(t)&&(i=t,t=""),i=r.extend(!0,{url:t},e.options,r.options("http",f,i)),null===i.crossOrigin&&(i.crossOrigin=s(i.url)),i.headers=r.extend({},e.headers.common,i.crossOrigin?{}:e.headers.custom,e.headers[i.method.toLowerCase()],i.headers),r.isPlainObject(i.data)&&/^(get|jsonp)$/i.test(i.method)&&(r.extend(i.params,i.data),delete i.data),i.emulateHTTP&&!i.crossOrigin&&/^(put|patch|delete)$/i.test(i.method)&&(i.headers["X-HTTP-Method-Override"]=i.method,i.method="post"),i.emulateJSON&&r.isPlainObject(i.data)&&(i.headers["Content-Type"]="application/x-www-form-urlencoded",i.data=c.params(i.data)),r.isObject(i.data)&&/FormData/i.test(i.data.toString())&&delete i.headers["Content-Type"],r.isPlainObject(i.data)&&(i.data=JSON.stringify(i.data)),u=("jsonp"==i.method.toLowerCase()?a:o).call(f,f.$url||c,i),u.then(n,n),u.success=function(t){return u.then(function(e){t.call(f,e.data,e.status,e)},function(){}),u},u.error=function(t){return u["catch"](function(e){t.call(f,e.data,e.status,e)}),u},u.always=function(t){var e=function(e){t.call(f,e.data,e.status,e)};return u.then(e,e),u},i.success&&u.success(i.success),i.error&&u.error(i.error),u}function n(t){try{t.data=JSON.parse(t.responseText)}catch(e){t.data=t.responseText}}function s(t){var e=c.parse(t);return e.protocol!==u.protocol||e.host!==u.host}var c=t.url,u=c.parse(location.href);return e.options={method:"get",params:{},data:"",jsonp:"callback",beforeSend:null,crossOrigin:null,emulateHTTP:!1,emulateJSON:!1},e.headers={put:i,post:i,patch:i,"delete":i,common:{Accept:"application/json, text/plain, */*"},custom:{"X-Requested-With":"XMLHttpRequest"}},["get","put","post","patch","delete","jsonp"].forEach(function(t){e[t]=function(e,n,o,a){return r.isFunction(n)&&(a=o,o=n,n=void 0),this(e,r.extend({method:t,data:n,success:o},a))}}),Object.defineProperty(t.prototype,"$http",{get:function(){return r.extend(e.bind(this),e)}}),e}},function(t,e,n){var r=n(2),o=n(5);t.exports=function(t,e){var n,a=new XMLHttpRequest;return r.isFunction(e.beforeSend)&&e.beforeSend.call(this,a,e),n=new o(function(n,o){a.open(e.method,t(e),!0),r.each(e.headers,function(t,e){a.setRequestHeader(e,t)}),a.onreadystatechange=function(){4===this.readyState&&(this.status>=200&&this.status<300?n(this):o(this))},a.send(e.data)}),r.extend(n,{abort:function(){a.abort()}}),n}},function(t,e){function n(t){this.state=a,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(n){e.reject(n)}}var r=0,o=1,a=2;n.reject=function(t){return new n(function(e,n){n(t)})},n.resolve=function(t){return new n(function(e,n){e(t)})},n.all=function(t){return new n(function(e,n){function r(n){return function(r){a[n]=r,o+=1,o===t.length&&e(a)}}var o=0,a=[];0===t.length&&e(a);for(var i=0;i<t.length;i+=1)t[i].then(r(i),n)})},n.race=function(t){return new n(function(e,n){for(var r=0;r<t.length;r+=1)t[r].then(e,n)})};var i=n.prototype;i.resolve=function(t){var e=this;if(e.state===a){if(t===e)throw new TypeError("Promise settled with itself.");var n=!1;try{var o=t&&t.then;if(null!==t&&"object"==typeof t&&"function"==typeof o)return void o.call(t,function(t){n||e.resolve(t),n=!0},function(t){n||e.reject(t),n=!0})}catch(i){return void(n||e.reject(i))}e.state=r,e.value=t,e.notify()}},i.reject=function(t){var e=this;if(e.state===a){if(t===e)throw new TypeError("Promise settled with itself.");e.state=o,e.value=t,e.notify()}},i.notify=function(){var t=this;c(function(){if(t.state!==a)for(;t.deferred.length;){var e=t.deferred.shift(),n=e[0],i=e[1],s=e[2],c=e[3];try{t.state===r?s("function"==typeof n?n.call(void 0,t.value):t.value):t.state===o&&("function"==typeof i?s(i.call(void 0,t.value)):c(t.value))}catch(u){c(u)}}})},i["catch"]=function(t){return this.then(void 0,t)},i.then=function(t,e){var r=this;return new n(function(n,o){r.deferred.push([t,e,n,o]),r.notify()})};var s=[],c=function(t){s.push(t),1===s.length&&c.async()};if(c.run=function(){for(;s.length;)s[0](),s.shift()},window.MutationObserver){var u=document.createElement("div"),f=new MutationObserver(c.run);f.observe(u,{attributes:!0}),c.async=function(){u.setAttribute("x",0)}}else c.async=function(){setTimeout(c.run)};t.exports=window.Promise||n},function(t,e,n){var r=n(2),o=n(5);t.exports=function(t,e){var n,a,i="_jsonp"+Math.random().toString(36).substr(2);return e.params[e.jsonp]=i,r.isFunction(e.beforeSend)&&e.beforeSend.call(this,{},e),new o(function(r,o){n=document.createElement("script"),n.src=t(e.url,e.params),n.type="text/javascript",n.async=!0,window[i]=function(t){a=t};var s=function(t){delete window[i],document.body.removeChild(n),"load"!==t.type||a||(t.type="error");var e=a?a:t.type,s="error"===t.type?404:200;(200===s?r:o)({responseText:e,status:s})};n.onload=s,n.onerror=s,document.body.appendChild(n)})}},function(t,e,n){var r=n(2);t.exports=function(t){function e(o,a,i){var s=this,c={};return i=r.extend({},e.actions,i),r.each(i,function(e,i){e=r.extend(!0,{url:o,params:a||{}},e),c[i]=function(){return(s.$http||t.http)(n(e,arguments))}}),c}function n(t,e){var n,o,a,i=r.extend({},t),s={};switch(e.length){case 4:a=e[3],o=e[2];case 3:case 2:if(!r.isFunction(e[1])){s=e[0],n=e[1],o=e[2];break}if(r.isFunction(e[0])){o=e[0],a=e[1];break}o=e[1],a=e[2];case 1:r.isFunction(e[0])?o=e[0]:/^(post|put|patch)$/i.test(i.method)?n=e[0]:s=e[0];break;case 0:break;default:throw"Expected up to 4 arguments [params, data, success, error], got "+e.length+" arguments"}return i.url=t.url,i.data=n,i.params=r.extend({},t.params,s),o&&(i.success=o),a&&(i.error=a),i}return e.actions={get:{method:"get"},save:{method:"post"},query:{method:"get"},remove:{method:"delete"},"delete":{method:"delete"}},Object.defineProperty(t.prototype,"$resource",{get:function(){return e.bind(this)}}),e}}])}); |
{ | ||
"name": "vue-resource", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "A web request service for Vue.js", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -27,3 +27,3 @@ /** | ||
options = _.extend(true, {url: url}, | ||
Http.options, _.options('http', this, options) | ||
Http.options, _.options('http', self, options) | ||
); | ||
@@ -47,3 +47,3 @@ | ||
if (options.emulateHTTP && !option.crossOrigin && /^(put|patch|delete)$/i.test(options.method)) { | ||
if (options.emulateHTTP && !options.crossOrigin && /^(put|patch|delete)$/i.test(options.method)) { | ||
options.headers['X-HTTP-Method-Override'] = options.method; | ||
@@ -66,3 +66,3 @@ options.method = 'post'; | ||
promise = (options.method.toLowerCase() == 'jsonp' ? jsonp : xhr).call(this, this.$url || Url, options); | ||
promise = (options.method.toLowerCase() == 'jsonp' ? jsonp : xhr).call(self, self.$url || Url, options); | ||
@@ -69,0 +69,0 @@ promise.then(transformResponse, transformResponse); |
@@ -5,5 +5,9 @@ /** | ||
var RESOLVED = 0; | ||
var REJECTED = 1; | ||
var PENDING = 2; | ||
function Promise(executor) { | ||
this.state = Promise.State.PENDING; | ||
this.state = PENDING; | ||
this.value = undefined; | ||
@@ -25,8 +29,2 @@ this.deferred = []; | ||
Promise.State = { | ||
RESOLVED: 0, | ||
REJECTED: 1, | ||
PENDING: 2 | ||
}; | ||
Promise.reject = function (r) { | ||
@@ -83,3 +81,3 @@ return new Promise(function (resolve, reject) { | ||
if (promise.state === Promise.State.PENDING) { | ||
if (promise.state === PENDING) { | ||
if (x === promise) { | ||
@@ -115,3 +113,3 @@ throw new TypeError('Promise settled with itself.'); | ||
} | ||
promise.state = Promise.State.RESOLVED; | ||
promise.state = RESOLVED; | ||
promise.value = x; | ||
@@ -125,3 +123,3 @@ promise.notify(); | ||
if (promise.state === Promise.State.PENDING) { | ||
if (promise.state === PENDING) { | ||
if (reason === promise) { | ||
@@ -131,3 +129,3 @@ throw new TypeError('Promise settled with itself.'); | ||
promise.state = Promise.State.REJECTED; | ||
promise.state = REJECTED; | ||
promise.value = reason; | ||
@@ -142,3 +140,3 @@ promise.notify(); | ||
async(function () { | ||
if (promise.state !== Promise.State.PENDING) { | ||
if (promise.state !== PENDING) { | ||
while (promise.deferred.length) { | ||
@@ -152,3 +150,3 @@ var deferred = promise.deferred.shift(), | ||
try { | ||
if (promise.state === Promise.State.RESOLVED) { | ||
if (promise.state === RESOLVED) { | ||
if (typeof onResolved === 'function') { | ||
@@ -159,3 +157,3 @@ resolve(onResolved.call(undefined, promise.value)); | ||
} | ||
} else if (promise.state === Promise.State.REJECTED) { | ||
} else if (promise.state === REJECTED) { | ||
if (typeof onRejected === 'function') { | ||
@@ -162,0 +160,0 @@ resolve(onRejected.call(undefined, promise.value)); |
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
55442
1342