Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

remove Promise polyfill #732

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/http/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
* Base client.
*/

import Promise from '../../promise';
import xhrClient from './xhr';
import nodeClient from './node';
import {warn, when, isObject, isFunction, inBrowser} from '../../util';
import {log, when, isObject, isFunction, inBrowser} from '../../util';

export default function (context) {

Expand Down Expand Up @@ -45,7 +44,7 @@ export default function (context) {
}

} else {
warn(`Invalid interceptor of type ${typeof handler}, must be a function`);
log(`Invalid interceptor of type ${typeof handler}, must be a function`);
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/http/client/jsonp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* JSONP client (Browser).
*/

import Promise from '../../promise';

export default function (request) {
return new Promise(resolve => {

Expand Down
1 change: 0 additions & 1 deletion src/http/client/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Http client (Node).
*/

import Promise from '../../promise';
import {each, trim} from '../../util';

export default function (request) {
Expand Down
2 changes: 0 additions & 2 deletions src/http/client/xdr.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* XDomain client (Internet Explorer).
*/

import Promise from '../../promise';

export default function (request) {
return new Promise(resolve => {

Expand Down
1 change: 0 additions & 1 deletion src/http/client/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* XMLHttp client (Browser).
*/

import Promise from '../../promise';
import {each, trim, isFunction} from '../../util';

export default function (request) {
Expand Down
1 change: 0 additions & 1 deletion src/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import method from './interceptor/method';
import header from './interceptor/header';
import Client from './client/index';
import Request from './request';
import Promise from '../promise';
import {assign, defaults, error, isString, isFunction} from '../util';

export default function Http(options) {
Expand Down
1 change: 0 additions & 1 deletion src/http/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

import Headers from './headers';
import Promise from '../promise';
import {when, isBlob, isString} from '../util';

export default class Response {
Expand Down
8 changes: 0 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import Url from './url/index';
import Http from './http/index';
import Promise from './promise';
import Resource from './resource';
import Util, {options} from './util';

Expand All @@ -19,7 +18,6 @@ function plugin(Vue) {
Vue.url = Url;
Vue.http = Http;
Vue.resource = Resource;
Vue.Promise = Promise;

Object.defineProperties(Vue.prototype, {

Expand All @@ -39,12 +37,6 @@ function plugin(Vue) {
get() {
return Vue.resource.bind(this);
}
},

$promise: {
get() {
return (executor) => new Vue.Promise(executor, this);
}
}

});
Expand Down
177 changes: 0 additions & 177 deletions src/lib/promise.js

This file was deleted.

77 changes: 0 additions & 77 deletions src/promise.js

This file was deleted.

19 changes: 7 additions & 12 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
* Utility functions.
*/

import Promise from './promise';
let _config = {};

var {hasOwnProperty} = {}, {slice} = [], debug = false, ntick;
const {hasOwnProperty} = {}, {slice} = [];

export const inBrowser = typeof window !== 'undefined';

export default function ({config, nextTick}) {
ntick = nextTick;
debug = config.debug || !config.silent;
export default function ({config}) {
_config = config;
}

export function warn(msg) {
if (typeof console !== 'undefined' && debug) {
console.warn('[VueResource warn]: ' + msg);
export function log(message, color = '#41B883') {
if (typeof console !== 'undefined' && _config.devtools) {
console.log(`%c vue-resource %c ${message} `, 'color: #fff; background: #35495E; padding: 1px; border-radius: 3px 0 0 3px;', `color: #fff; background: ${color}; padding: 1px; border-radius: 0 3px 3px 0;`);
}
}

Expand All @@ -25,10 +24,6 @@ export function error(msg) {
}
}

export function nextTick(cb, ctx) {
return ntick(cb, ctx);
}

export function trim(str) {
return str ? str.replace(/^\s*|\s*$/g, '') : '';
}
Expand Down
1 change: 0 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ Vue.use(VueResource);
require('./url');
require('./http');
require('./resource');
require('./promise');
Loading