49 | ```
50 | ```C++
51 | int main(){
52 | int a = 10, b = 20;
53 | int sum( int a , int b){
54 | return a+b;
55 | }
56 | return sum( a, b );
57 | }
58 | ```
59 | ```js
60 | angular.module('app', [])
61 | .controller('main', ['$scope', function ($scope) {
62 |
63 | $scope.gesture = function (event) {
64 |
65 | switch (event.type) {
66 |
67 | case 'touchstart':
68 | //在这里书写 touchstart 要做的事
69 | break;
70 |
71 | case 'touchmove':
72 | //在这里书写 touchmove 要做的事
73 | break;
74 |
75 | case 'touchend':
76 | //在这里书写 touchend 要做的事
77 | break;
78 |
79 | }
80 |
81 | }
82 |
83 | }])
84 | ```
85 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # angularJS
2 |
3 | 这个仓库提供 git 使用教程 gulp 使用教程 angularJS 入门的教程。
4 |
5 | 仓库会不定期更新。
--------------------------------------------------------------------------------
/angularJS-tab切换/README.md:
--------------------------------------------------------------------------------
1 | # 简介(Abstract)
2 |
3 | 这是一个使用自定义指令+mock数据来实现tab切换的例子。
4 |
5 | this is a demo for achieve TabBar by directive and mockserver .
6 |
7 | ## 使用方法(Usage)
8 |
9 | git clone git@github.com:PsChina/angularJS.git
10 |
11 | cd angularJS-tab切换
12 |
13 | ### npm
14 |
15 | 1. npm i ↵
16 |
17 | 2. gulp ↵
18 |
19 | 3. open your browser open http://localhost:8080
20 |
21 | ### cnpm
22 |
23 | 1. cnpm i 回车
24 |
25 | 2. gulp 回车
26 |
27 | 3. 打开浏览器 输入 http://localhost:8080 回车
--------------------------------------------------------------------------------
/angularJS-tab切换/gulpfile.js:
--------------------------------------------------------------------------------
1 | var obj = [{
2 | name:'热菜',
3 | value:[{
4 | name:'西红柿炒鸡蛋',
5 | price:.1
6 | },{
7 | name:'红烧肉',
8 | price:.2
9 | },{
10 | name:'醋溜排骨',
11 | price:.3
12 | }
13 | ]
14 | },{
15 | name:'凉菜',
16 | value:[{
17 | name:'拍黄瓜',
18 | price:.4
19 | },{
20 | name:'老醋花生',
21 | price:.5
22 | },{
23 | name:'雪盖火焰山',
24 | price:.6
25 | }]
26 | },{
27 | name:'甜点',
28 | value:[{
29 | name:'拔丝香蕉',
30 | price:.7
31 | },{
32 | name:'蛋挞',
33 | price:.8
34 | },{
35 | name:'慕斯蛋糕',
36 | price:.9
37 | }]
38 | },{
39 | name:'饮料',
40 | value:[{
41 | name:'北冰洋',
42 | price:1
43 | },{
44 | name:'橙汁',
45 | price:1.1
46 | },{
47 | name:'青岛啤酒',
48 | price:1.2
49 | }]
50 | }]
51 |
52 | var gulp = require('gulp')
53 |
54 | var webserver = require('gulp-webserver') //这个启动后端服务器的 包
55 |
56 | var connect = require('gulp-connect') //这个是启动前端服务器的 包
57 |
58 | var urlTool = require('url');
59 |
60 | var qs = require('qs');
61 |
62 | gulp.task('mockServer',function(){
63 | gulp.src('.')
64 | .pipe(webserver({
65 | port:3000,
66 | middleware:function(req,res,next){
67 |
68 | var method = req.method;
69 |
70 | var urlObj = urlTool.parse(req.url)
71 |
72 | var pathname = urlObj.pathname;
73 |
74 | res.setHeader('Access-Control-Allow-Origin','*')
75 |
76 | if(method == 'GET'){
77 |
78 | switch (pathname) {
79 | case '/goodslist':
80 | res.setHeader('content-type','application/json;charset=utf-8')
81 | res.write(JSON.stringify(obj));
82 | res.end();
83 | break;
84 |
85 | default:
86 | break;
87 | }
88 |
89 | }else if(method == 'POST'){
90 |
91 | var postParamsStr = '';
92 |
93 | req.on('data',function(chunk){
94 | postParamsStr +=chunk;
95 | })
96 |
97 | req.on('end',function(){
98 |
99 |
100 | var postParamsJson =
101 |
102 | postParamsStr.indexOf('{')!=-1&&postParamsStr.indexOf('}')!=-1
103 |
104 | ?
105 |
106 | JSON.parse(postParamsStr)
107 |
108 | :
109 |
110 | qs.parse(postParamsStr)
111 |
112 |
113 |
114 |
115 | switch (pathname) {
116 | case '/login':
117 | if(postParamsJson.userName == '张三' && postParamsJson.password==123456) {
118 |
119 | }
120 | break;
121 | case '/register':
122 |
123 | break;
124 | default:
125 | break;
126 | }
127 | })
128 |
129 |
130 |
131 |
132 | }
133 |
134 | }
135 | }))
136 | })
137 |
138 |
139 | gulp.task('httpServer',function(){
140 | connect.server({
141 | port:8080,
142 | livereload:true
143 | })
144 | })
145 |
146 | gulp.task('default',['mockServer','httpServer'])
147 |
148 |
--------------------------------------------------------------------------------
/angularJS-tab切换/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/angularJS-tab切换/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ng-directive-tab",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "gulpfile.js",
6 | "dependencies": {
7 | "gulp":"^3.9.1",
8 | "gulp-connect":"^5.0.0",
9 | "gulp-webserver":"^0.9.1"
10 | },
11 | "devDependencies": {},
12 | "scripts": {
13 | "test": "echo \"Error: no test specified\" && exit 1"
14 | },
15 | "author": "",
16 | "license": "ISC"
17 | }
18 |
--------------------------------------------------------------------------------
/angularJS-tab切换/tab.html:
--------------------------------------------------------------------------------
1 |
2 |
34 |
35 |
36 | {{item.name}}
37 |
38 |
39 |
40 |
41 |
42 | {{cai.name}}
43 |
44 |
45 | {{cai.price | currency : '¥'}}
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/demos/多级联动筛选demo/selectfunc.js:
--------------------------------------------------------------------------------
1 | const serverMessage = {
2 | "success":true,
3 | "code":"0",
4 | "data": {
5 | "list": [
6 | {
7 | "name":"检修电工",
8 | "select":false,
9 | "list": [
10 | {
11 | "name":"检修班组一",
12 | "select":false,
13 | "list":[
14 | {
15 | "id":"1",
16 | "name":"检修-赵工",
17 | "role":"E",
18 | "select":false,
19 | },
20 | {
21 | "id":"2",
22 | "name":"检修-钱工",
23 | "role":"E",
24 | "select":false,
25 | }
26 | ]
27 | },
28 | {
29 | name:"检修班组二",
30 | "select":false,
31 | "list":[
32 | {
33 | "id":"3",
34 | "name":"检修-孙工",
35 | "role":"E",
36 | "select":false,
37 | },
38 | {
39 | "id":"4",
40 | "name":"检修-李工",
41 | "role":"E",
42 | "select":false,
43 | }
44 | ]
45 | }
46 |
47 | ]
48 | },
49 | {
50 | "name":"运行电工",
51 | "select":false,
52 | "list": [
53 | {
54 | "id":"5",
55 | "name":"运行电工NO1",
56 | "role":"E",
57 | "select":false,
58 | },
59 | {
60 | "id":"6",
61 | "name":"运行-张工",
62 | "role":"E",
63 | "select":false,
64 | }
65 | ]
66 | }
67 | ]
68 | }
69 | }
70 |
71 |
72 | function addSelectAttr(list){
73 | if(Array.isArray(list)){
74 | for(const item of list){
75 | item.select = false;
76 | if(item['list']){
77 | addSelectAttr(item.list)
78 | }
79 | }
80 | }
81 | }
82 |
83 | function changeSelectStatus(selectVal,item){
84 | item.select = !item.select; //改变select状态
85 | if(item['list']){
86 | if(Array.isArray(item.list)){
87 | for(const subItem of item.list){
88 | changeSelectStatus(item.select,subItem);
89 | }
90 | }
91 | }
92 | return item
93 | }
94 |
95 | function findId (item,selectedItemArr=[]) {
96 | if(item['id']){
97 | selectedItemArr.push(item)
98 | }else{
99 | if(item['list']){
100 | for(const subItem of item.list){
101 | findId(subItem,selectedItemArr);
102 | }
103 | }
104 | }
105 | return selectedItemArr
106 | }
107 |
108 | function filterDidSelect (list) {
109 | let resultList = [];
110 | for(const item of list){
111 | if(item.select){ // select为true 表示已经选择
112 | resultList = resultList.concat( findId(item,resultList) )
113 | }else{ // 查看子元素是被选择
114 | resultList = resultList.concat( filterDidSelect(item['list']?item.list:[]) )
115 | }
116 | }
117 | let finallyItemArr = []
118 | resultList.forEach((item)=>{ // 数组去重
119 | let ok = true;
120 | finallyItemArr.forEach((finallyItem)=>{
121 | if(finallyItem.id === item.id){
122 | ok = false;
123 | }
124 | })
125 | if(ok){
126 | delete item.select;
127 | finallyItemArr.push(item)
128 | }
129 | })
130 | return finallyItemArr;
131 | }
132 |
133 | changeSelectStatus(true,serverMessage.data.list[Math.floor(Math.random()*2)]) // 测试 选择函数
134 |
135 | console.log(JSON.stringify(serverMessage))
136 |
137 | const result = filterDidSelect(serverMessage.data.list) // 测试筛选函数
138 |
139 | console.log(result); // 输出结果
140 |
--------------------------------------------------------------------------------
/nrm/nrm.md:
--------------------------------------------------------------------------------
1 | # nrm
2 |
3 | nrm 是一个npm的源管理工具
4 |
5 | ## 获取
6 |
7 | npm install nrm -g
8 |
9 | ## 使用
10 |
11 | ### nrm ls
12 |
13 | 查看所有源
14 |
15 | ### nrm test
16 |
17 | 测试各个源的链接延迟
18 |
19 | ### nrm use
20 |
21 | 切换到某个源
22 |
23 | 例如 nrm use cnpm
24 |
25 | ### nrm current
26 |
27 | 查看当前使用的源
28 |
29 | ### nrm help
30 |
31 | 查看所有nrm命令
32 |
33 |
34 | ### 后记
35 | cnpm 与 npm 的优劣
36 | 由于防火长城的存在 使得我们的一些npm包无法通过,导致下载失败,但cnpm使用了vpn(虚拟专用网络)绕开了防火长城 每15分钟会与npm保持同步
37 | cnpm的服务器在国内所以速度比较快
38 | npm 使用官网源 所以可以正常发布npm包
39 | 在使用cnpm时使用的不是 npm官网源 所以无法登录npm账号,也就无法发布npm包了。
40 |
41 |
--------------------------------------------------------------------------------
/端口号被占用如何解决.md:
--------------------------------------------------------------------------------
1 | #1、使用netstat -nao
2 | 查看所有被使用的端口 以及它的PID
3 |
4 | #2、使用 taskkill -pid PID
5 | 比如 taskkill -pid 8036
6 |
7 | #3、强制删除命令
8 | taskkill /f -pid 8036
--------------------------------------------------------------------------------
/设计模式/1.单例设计模式.md:
--------------------------------------------------------------------------------
1 | # 单例
2 |
3 | 单例就是 打个比方 你有7个老婆
4 | 那么当这7个老婆的任何一个老婆叫老公的时候 指的都是你
5 | 但是除了你的7个老婆之外任何人叫老公指的都不是你
6 |
7 | ## js例子
8 |
9 | ```js
10 | function SingletonInstance() {
11 | if (!SingletonInstance.self) {
12 | this.name = 'zhangsan';
13 | this.age = 19;
14 | SingletonInstance.self = this;
15 | } else {
16 | return SingletonInstance.self;
17 | }
18 | }
19 |
20 | var instanceA = new SingletonInstance()
21 | instanceA.name = 'wangwu'
22 | var instanceB = new SingletonInstance()
23 |
24 | console.log(instanceA === instanceB) // =>> true
25 | console.log(instanceA,instanceB)
26 | // =>> {"name":"wangwu","age":"19"} {"name":"wangwu","age":"19"}
27 |
28 | ```
29 |
30 | [更多设计模式](https://github.com/PsChina/DesignPattern)
--------------------------------------------------------------------------------
/跨域问题/iframe+window.name/READEME.md:
--------------------------------------------------------------------------------
1 | # window.name + iframe 解决跨域
2 |
3 | 大家请参考网上的[文章](https://www.cnblogs.com/zichi/p/4620656.html)。
4 |
5 |
6 | ```javascript
7 | ['文章使用php返回,我用的是node返回']
8 | ```
9 |
10 | ```
11 | 这次跟新是我练习跨域的方式之后还会尝试 postMessage 的方式尝试跨域 至于注释以后有时间我会来整理。感谢大家的支持。
12 | ```
13 |
--------------------------------------------------------------------------------
/跨域问题/iframe+window.name/axios.js:
--------------------------------------------------------------------------------
1 | /* axios v0.18.0 | (c) 2018 by Matt Zabriskie */
2 | (function webpackUniversalModuleDefinition(root, factory) {
3 | if(typeof exports === 'object' && typeof module === 'object')
4 | module.exports = factory();
5 | else if(typeof define === 'function' && define.amd)
6 | define([], factory);
7 | else if(typeof exports === 'object')
8 | exports["axios"] = factory();
9 | else
10 | root["axios"] = factory();
11 | })(this, function() {
12 | return /******/ (function(modules) { // webpackBootstrap
13 | /******/ // The module cache
14 | /******/ var installedModules = {};
15 | /******/
16 | /******/ // The require function
17 | /******/ function __webpack_require__(moduleId) {
18 | /******/
19 | /******/ // Check if module is in cache
20 | /******/ if(installedModules[moduleId])
21 | /******/ return installedModules[moduleId].exports;
22 | /******/
23 | /******/ // Create a new module (and put it into the cache)
24 | /******/ var module = installedModules[moduleId] = {
25 | /******/ exports: {},
26 | /******/ id: moduleId,
27 | /******/ loaded: false
28 | /******/ };
29 | /******/
30 | /******/ // Execute the module function
31 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
32 | /******/
33 | /******/ // Flag the module as loaded
34 | /******/ module.loaded = true;
35 | /******/
36 | /******/ // Return the exports of the module
37 | /******/ return module.exports;
38 | /******/ }
39 | /******/
40 | /******/
41 | /******/ // expose the modules object (__webpack_modules__)
42 | /******/ __webpack_require__.m = modules;
43 | /******/
44 | /******/ // expose the module cache
45 | /******/ __webpack_require__.c = installedModules;
46 | /******/
47 | /******/ // __webpack_public_path__
48 | /******/ __webpack_require__.p = "";
49 | /******/
50 | /******/ // Load entry module and return exports
51 | /******/ return __webpack_require__(0);
52 | /******/ })
53 | /************************************************************************/
54 | /******/ ([
55 | /* 0 */
56 | /***/ (function(module, exports, __webpack_require__) {
57 |
58 | module.exports = __webpack_require__(1);
59 |
60 | /***/ }),
61 | /* 1 */
62 | /***/ (function(module, exports, __webpack_require__) {
63 |
64 | 'use strict';
65 |
66 | var utils = __webpack_require__(2);
67 | var bind = __webpack_require__(3);
68 | var Axios = __webpack_require__(5);
69 | var defaults = __webpack_require__(6);
70 |
71 | /**
72 | * Create an instance of Axios
73 | *
74 | * @param {Object} defaultConfig The default config for the instance
75 | * @return {Axios} A new instance of Axios
76 | */
77 | function createInstance(defaultConfig) {
78 | var context = new Axios(defaultConfig);
79 | var instance = bind(Axios.prototype.request, context);
80 |
81 | // Copy axios.prototype to instance
82 | utils.extend(instance, Axios.prototype, context);
83 |
84 | // Copy context to instance
85 | utils.extend(instance, context);
86 |
87 | return instance;
88 | }
89 |
90 | // Create the default instance to be exported
91 | var axios = createInstance(defaults);
92 |
93 | // Expose Axios class to allow class inheritance
94 | axios.Axios = Axios;
95 |
96 | // Factory for creating new instances
97 | axios.create = function create(instanceConfig) {
98 | return createInstance(utils.merge(defaults, instanceConfig));
99 | };
100 |
101 | // Expose Cancel & CancelToken
102 | axios.Cancel = __webpack_require__(23);
103 | axios.CancelToken = __webpack_require__(24);
104 | axios.isCancel = __webpack_require__(20);
105 |
106 | // Expose all/spread
107 | axios.all = function all(promises) {
108 | return Promise.all(promises);
109 | };
110 | axios.spread = __webpack_require__(25);
111 |
112 | module.exports = axios;
113 |
114 | // Allow use of default import syntax in TypeScript
115 | module.exports.default = axios;
116 |
117 |
118 | /***/ }),
119 | /* 2 */
120 | /***/ (function(module, exports, __webpack_require__) {
121 |
122 | 'use strict';
123 |
124 | var bind = __webpack_require__(3);
125 | var isBuffer = __webpack_require__(4);
126 |
127 | /*global toString:true*/
128 |
129 | // utils is a library of generic helper functions non-specific to axios
130 |
131 | var toString = Object.prototype.toString;
132 |
133 | /**
134 | * Determine if a value is an Array
135 | *
136 | * @param {Object} val The value to test
137 | * @returns {boolean} True if value is an Array, otherwise false
138 | */
139 | function isArray(val) {
140 | return toString.call(val) === '[object Array]';
141 | }
142 |
143 | /**
144 | * Determine if a value is an ArrayBuffer
145 | *
146 | * @param {Object} val The value to test
147 | * @returns {boolean} True if value is an ArrayBuffer, otherwise false
148 | */
149 | function isArrayBuffer(val) {
150 | return toString.call(val) === '[object ArrayBuffer]';
151 | }
152 |
153 | /**
154 | * Determine if a value is a FormData
155 | *
156 | * @param {Object} val The value to test
157 | * @returns {boolean} True if value is an FormData, otherwise false
158 | */
159 | function isFormData(val) {
160 | return (typeof FormData !== 'undefined') && (val instanceof FormData);
161 | }
162 |
163 | /**
164 | * Determine if a value is a view on an ArrayBuffer
165 | *
166 | * @param {Object} val The value to test
167 | * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
168 | */
169 | function isArrayBufferView(val) {
170 | var result;
171 | if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
172 | result = ArrayBuffer.isView(val);
173 | } else {
174 | result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
175 | }
176 | return result;
177 | }
178 |
179 | /**
180 | * Determine if a value is a String
181 | *
182 | * @param {Object} val The value to test
183 | * @returns {boolean} True if value is a String, otherwise false
184 | */
185 | function isString(val) {
186 | return typeof val === 'string';
187 | }
188 |
189 | /**
190 | * Determine if a value is a Number
191 | *
192 | * @param {Object} val The value to test
193 | * @returns {boolean} True if value is a Number, otherwise false
194 | */
195 | function isNumber(val) {
196 | return typeof val === 'number';
197 | }
198 |
199 | /**
200 | * Determine if a value is undefined
201 | *
202 | * @param {Object} val The value to test
203 | * @returns {boolean} True if the value is undefined, otherwise false
204 | */
205 | function isUndefined(val) {
206 | return typeof val === 'undefined';
207 | }
208 |
209 | /**
210 | * Determine if a value is an Object
211 | *
212 | * @param {Object} val The value to test
213 | * @returns {boolean} True if value is an Object, otherwise false
214 | */
215 | function isObject(val) {
216 | return val !== null && typeof val === 'object';
217 | }
218 |
219 | /**
220 | * Determine if a value is a Date
221 | *
222 | * @param {Object} val The value to test
223 | * @returns {boolean} True if value is a Date, otherwise false
224 | */
225 | function isDate(val) {
226 | return toString.call(val) === '[object Date]';
227 | }
228 |
229 | /**
230 | * Determine if a value is a File
231 | *
232 | * @param {Object} val The value to test
233 | * @returns {boolean} True if value is a File, otherwise false
234 | */
235 | function isFile(val) {
236 | return toString.call(val) === '[object File]';
237 | }
238 |
239 | /**
240 | * Determine if a value is a Blob
241 | *
242 | * @param {Object} val The value to test
243 | * @returns {boolean} True if value is a Blob, otherwise false
244 | */
245 | function isBlob(val) {
246 | return toString.call(val) === '[object Blob]';
247 | }
248 |
249 | /**
250 | * Determine if a value is a Function
251 | *
252 | * @param {Object} val The value to test
253 | * @returns {boolean} True if value is a Function, otherwise false
254 | */
255 | function isFunction(val) {
256 | return toString.call(val) === '[object Function]';
257 | }
258 |
259 | /**
260 | * Determine if a value is a Stream
261 | *
262 | * @param {Object} val The value to test
263 | * @returns {boolean} True if value is a Stream, otherwise false
264 | */
265 | function isStream(val) {
266 | return isObject(val) && isFunction(val.pipe);
267 | }
268 |
269 | /**
270 | * Determine if a value is a URLSearchParams object
271 | *
272 | * @param {Object} val The value to test
273 | * @returns {boolean} True if value is a URLSearchParams object, otherwise false
274 | */
275 | function isURLSearchParams(val) {
276 | return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
277 | }
278 |
279 | /**
280 | * Trim excess whitespace off the beginning and end of a string
281 | *
282 | * @param {String} str The String to trim
283 | * @returns {String} The String freed of excess whitespace
284 | */
285 | function trim(str) {
286 | return str.replace(/^\s*/, '').replace(/\s*$/, '');
287 | }
288 |
289 | /**
290 | * Determine if we're running in a standard browser environment
291 | *
292 | * This allows axios to run in a web worker, and react-native.
293 | * Both environments support XMLHttpRequest, but not fully standard globals.
294 | *
295 | * web workers:
296 | * typeof window -> undefined
297 | * typeof document -> undefined
298 | *
299 | * react-native:
300 | * navigator.product -> 'ReactNative'
301 | */
302 | function isStandardBrowserEnv() {
303 | if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
304 | return false;
305 | }
306 | return (
307 | typeof window !== 'undefined' &&
308 | typeof document !== 'undefined'
309 | );
310 | }
311 |
312 | /**
313 | * Iterate over an Array or an Object invoking a function for each item.
314 | *
315 | * If `obj` is an Array callback will be called passing
316 | * the value, index, and complete array for each item.
317 | *
318 | * If 'obj' is an Object callback will be called passing
319 | * the value, key, and complete object for each property.
320 | *
321 | * @param {Object|Array} obj The object to iterate
322 | * @param {Function} fn The callback to invoke for each item
323 | */
324 | function forEach(obj, fn) {
325 | // Don't bother if no value provided
326 | if (obj === null || typeof obj === 'undefined') {
327 | return;
328 | }
329 |
330 | // Force an array if not already something iterable
331 | if (typeof obj !== 'object') {
332 | /*eslint no-param-reassign:0*/
333 | obj = [obj];
334 | }
335 |
336 | if (isArray(obj)) {
337 | // Iterate over array values
338 | for (var i = 0, l = obj.length; i < l; i++) {
339 | fn.call(null, obj[i], i, obj);
340 | }
341 | } else {
342 | // Iterate over object keys
343 | for (var key in obj) {
344 | if (Object.prototype.hasOwnProperty.call(obj, key)) {
345 | fn.call(null, obj[key], key, obj);
346 | }
347 | }
348 | }
349 | }
350 |
351 | /**
352 | * Accepts varargs expecting each argument to be an object, then
353 | * immutably merges the properties of each object and returns result.
354 | *
355 | * When multiple objects contain the same key the later object in
356 | * the arguments list will take precedence.
357 | *
358 | * Example:
359 | *
360 | * ```js
361 | * var result = merge({foo: 123}, {foo: 456});
362 | * console.log(result.foo); // outputs 456
363 | * ```
364 | *
365 | * @param {Object} obj1 Object to merge
366 | * @returns {Object} Result of all merge properties
367 | */
368 | function merge(/* obj1, obj2, obj3, ... */) {
369 | var result = {};
370 | function assignValue(val, key) {
371 | if (typeof result[key] === 'object' && typeof val === 'object') {
372 | result[key] = merge(result[key], val);
373 | } else {
374 | result[key] = val;
375 | }
376 | }
377 |
378 | for (var i = 0, l = arguments.length; i < l; i++) {
379 | forEach(arguments[i], assignValue);
380 | }
381 | return result;
382 | }
383 |
384 | /**
385 | * Extends object a by mutably adding to it the properties of object b.
386 | *
387 | * @param {Object} a The object to be extended
388 | * @param {Object} b The object to copy properties from
389 | * @param {Object} thisArg The object to bind function to
390 | * @return {Object} The resulting value of object a
391 | */
392 | function extend(a, b, thisArg) {
393 | forEach(b, function assignValue(val, key) {
394 | if (thisArg && typeof val === 'function') {
395 | a[key] = bind(val, thisArg);
396 | } else {
397 | a[key] = val;
398 | }
399 | });
400 | return a;
401 | }
402 |
403 | module.exports = {
404 | isArray: isArray,
405 | isArrayBuffer: isArrayBuffer,
406 | isBuffer: isBuffer,
407 | isFormData: isFormData,
408 | isArrayBufferView: isArrayBufferView,
409 | isString: isString,
410 | isNumber: isNumber,
411 | isObject: isObject,
412 | isUndefined: isUndefined,
413 | isDate: isDate,
414 | isFile: isFile,
415 | isBlob: isBlob,
416 | isFunction: isFunction,
417 | isStream: isStream,
418 | isURLSearchParams: isURLSearchParams,
419 | isStandardBrowserEnv: isStandardBrowserEnv,
420 | forEach: forEach,
421 | merge: merge,
422 | extend: extend,
423 | trim: trim
424 | };
425 |
426 |
427 | /***/ }),
428 | /* 3 */
429 | /***/ (function(module, exports) {
430 |
431 | 'use strict';
432 |
433 | module.exports = function bind(fn, thisArg) {
434 | return function wrap() {
435 | var args = new Array(arguments.length);
436 | for (var i = 0; i < args.length; i++) {
437 | args[i] = arguments[i];
438 | }
439 | return fn.apply(thisArg, args);
440 | };
441 | };
442 |
443 |
444 | /***/ }),
445 | /* 4 */
446 | /***/ (function(module, exports) {
447 |
448 | /*!
449 | * Determine if an object is a Buffer
450 | *
451 | * @author Feross Aboukhadijeh
452 | * @license MIT
453 | */
454 |
455 | // The _isBuffer check is for Safari 5-7 support, because it's missing
456 | // Object.prototype.constructor. Remove this eventually
457 | module.exports = function (obj) {
458 | return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
459 | }
460 |
461 | function isBuffer (obj) {
462 | return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
463 | }
464 |
465 | // For Node v0.10 support. Remove this eventually.
466 | function isSlowBuffer (obj) {
467 | return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
468 | }
469 |
470 |
471 | /***/ }),
472 | /* 5 */
473 | /***/ (function(module, exports, __webpack_require__) {
474 |
475 | 'use strict';
476 |
477 | var defaults = __webpack_require__(6);
478 | var utils = __webpack_require__(2);
479 | var InterceptorManager = __webpack_require__(17);
480 | var dispatchRequest = __webpack_require__(18);
481 |
482 | /**
483 | * Create a new instance of Axios
484 | *
485 | * @param {Object} instanceConfig The default config for the instance
486 | */
487 | function Axios(instanceConfig) {
488 | this.defaults = instanceConfig;
489 | this.interceptors = {
490 | request: new InterceptorManager(),
491 | response: new InterceptorManager()
492 | };
493 | }
494 |
495 | /**
496 | * Dispatch a request
497 | *
498 | * @param {Object} config The config specific for this request (merged with this.defaults)
499 | */
500 | Axios.prototype.request = function request(config) {
501 | /*eslint no-param-reassign:0*/
502 | // Allow for axios('example/url'[, config]) a la fetch API
503 | if (typeof config === 'string') {
504 | config = utils.merge({
505 | url: arguments[0]
506 | }, arguments[1]);
507 | }
508 |
509 | config = utils.merge(defaults, {method: 'get'}, this.defaults, config);
510 | config.method = config.method.toLowerCase();
511 |
512 | // Hook up interceptors middleware
513 | var chain = [dispatchRequest, undefined];
514 | var promise = Promise.resolve(config);
515 |
516 | this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
517 | chain.unshift(interceptor.fulfilled, interceptor.rejected);
518 | });
519 |
520 | this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
521 | chain.push(interceptor.fulfilled, interceptor.rejected);
522 | });
523 |
524 | while (chain.length) {
525 | promise = promise.then(chain.shift(), chain.shift());
526 | }
527 |
528 | return promise;
529 | };
530 |
531 | // Provide aliases for supported request methods
532 | utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
533 | /*eslint func-names:0*/
534 | Axios.prototype[method] = function(url, config) {
535 | return this.request(utils.merge(config || {}, {
536 | method: method,
537 | url: url
538 | }));
539 | };
540 | });
541 |
542 | utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
543 | /*eslint func-names:0*/
544 | Axios.prototype[method] = function(url, data, config) {
545 | return this.request(utils.merge(config || {}, {
546 | method: method,
547 | url: url,
548 | data: data
549 | }));
550 | };
551 | });
552 |
553 | module.exports = Axios;
554 |
555 |
556 | /***/ }),
557 | /* 6 */
558 | /***/ (function(module, exports, __webpack_require__) {
559 |
560 | 'use strict';
561 |
562 | var utils = __webpack_require__(2);
563 | var normalizeHeaderName = __webpack_require__(7);
564 |
565 | var DEFAULT_CONTENT_TYPE = {
566 | 'Content-Type': 'application/x-www-form-urlencoded'
567 | };
568 |
569 | function setContentTypeIfUnset(headers, value) {
570 | if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
571 | headers['Content-Type'] = value;
572 | }
573 | }
574 |
575 | function getDefaultAdapter() {
576 | var adapter;
577 | if (typeof XMLHttpRequest !== 'undefined') {
578 | // For browsers use XHR adapter
579 | adapter = __webpack_require__(8);
580 | } else if (typeof process !== 'undefined') {
581 | // For node use HTTP adapter
582 | adapter = __webpack_require__(8);
583 | }
584 | return adapter;
585 | }
586 |
587 | var defaults = {
588 | adapter: getDefaultAdapter(),
589 |
590 | transformRequest: [function transformRequest(data, headers) {
591 | normalizeHeaderName(headers, 'Content-Type');
592 | if (utils.isFormData(data) ||
593 | utils.isArrayBuffer(data) ||
594 | utils.isBuffer(data) ||
595 | utils.isStream(data) ||
596 | utils.isFile(data) ||
597 | utils.isBlob(data)
598 | ) {
599 | return data;
600 | }
601 | if (utils.isArrayBufferView(data)) {
602 | return data.buffer;
603 | }
604 | if (utils.isURLSearchParams(data)) {
605 | setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
606 | return data.toString();
607 | }
608 | if (utils.isObject(data)) {
609 | setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
610 | return JSON.stringify(data);
611 | }
612 | return data;
613 | }],
614 |
615 | transformResponse: [function transformResponse(data) {
616 | /*eslint no-param-reassign:0*/
617 | if (typeof data === 'string') {
618 | try {
619 | data = JSON.parse(data);
620 | } catch (e) { /* Ignore */ }
621 | }
622 | return data;
623 | }],
624 |
625 | /**
626 | * A timeout in milliseconds to abort a request. If set to 0 (default) a
627 | * timeout is not created.
628 | */
629 | timeout: 0,
630 |
631 | xsrfCookieName: 'XSRF-TOKEN',
632 | xsrfHeaderName: 'X-XSRF-TOKEN',
633 |
634 | maxContentLength: -1,
635 |
636 | validateStatus: function validateStatus(status) {
637 | return status >= 200 && status < 300;
638 | }
639 | };
640 |
641 | defaults.headers = {
642 | common: {
643 | 'Accept': 'application/json, text/plain, */*'
644 | }
645 | };
646 |
647 | utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
648 | defaults.headers[method] = {};
649 | });
650 |
651 | utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
652 | defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
653 | });
654 |
655 | module.exports = defaults;
656 |
657 |
658 | /***/ }),
659 | /* 7 */
660 | /***/ (function(module, exports, __webpack_require__) {
661 |
662 | 'use strict';
663 |
664 | var utils = __webpack_require__(2);
665 |
666 | module.exports = function normalizeHeaderName(headers, normalizedName) {
667 | utils.forEach(headers, function processHeader(value, name) {
668 | if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
669 | headers[normalizedName] = value;
670 | delete headers[name];
671 | }
672 | });
673 | };
674 |
675 |
676 | /***/ }),
677 | /* 8 */
678 | /***/ (function(module, exports, __webpack_require__) {
679 |
680 | 'use strict';
681 |
682 | var utils = __webpack_require__(2);
683 | var settle = __webpack_require__(9);
684 | var buildURL = __webpack_require__(12);
685 | var parseHeaders = __webpack_require__(13);
686 | var isURLSameOrigin = __webpack_require__(14);
687 | var createError = __webpack_require__(10);
688 | var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(15);
689 |
690 | module.exports = function xhrAdapter(config) {
691 | return new Promise(function dispatchXhrRequest(resolve, reject) {
692 | var requestData = config.data;
693 | var requestHeaders = config.headers;
694 |
695 | if (utils.isFormData(requestData)) {
696 | delete requestHeaders['Content-Type']; // Let the browser set it
697 | }
698 |
699 | var request = new XMLHttpRequest();
700 | var loadEvent = 'onreadystatechange';
701 | var xDomain = false;
702 |
703 | // For IE 8/9 CORS support
704 | // Only supports POST and GET calls and doesn't returns the response headers.
705 | // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
706 | if (("production") !== 'test' &&
707 | typeof window !== 'undefined' &&
708 | window.XDomainRequest && !('withCredentials' in request) &&
709 | !isURLSameOrigin(config.url)) {
710 | request = new window.XDomainRequest();
711 | loadEvent = 'onload';
712 | xDomain = true;
713 | request.onprogress = function handleProgress() {};
714 | request.ontimeout = function handleTimeout() {};
715 | }
716 |
717 | // HTTP basic authentication
718 | if (config.auth) {
719 | var username = config.auth.username || '';
720 | var password = config.auth.password || '';
721 | requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
722 | }
723 |
724 | request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
725 |
726 | // Set the request timeout in MS
727 | request.timeout = config.timeout;
728 |
729 | // Listen for ready state
730 | request[loadEvent] = function handleLoad() {
731 | if (!request || (request.readyState !== 4 && !xDomain)) {
732 | return;
733 | }
734 |
735 | // The request errored out and we didn't get a response, this will be
736 | // handled by onerror instead
737 | // With one exception: request that using file: protocol, most browsers
738 | // will return status as 0 even though it's a successful request
739 | if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
740 | return;
741 | }
742 |
743 | // Prepare the response
744 | var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
745 | var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
746 | var response = {
747 | data: responseData,
748 | // IE sends 1223 instead of 204 (https://github.com/axios/axios/issues/201)
749 | status: request.status === 1223 ? 204 : request.status,
750 | statusText: request.status === 1223 ? 'No Content' : request.statusText,
751 | headers: responseHeaders,
752 | config: config,
753 | request: request
754 | };
755 |
756 | settle(resolve, reject, response);
757 |
758 | // Clean up request
759 | request = null;
760 | };
761 |
762 | // Handle low level network errors
763 | request.onerror = function handleError() {
764 | // Real errors are hidden from us by the browser
765 | // onerror should only fire if it's a network error
766 | reject(createError('Network Error', config, null, request));
767 |
768 | // Clean up request
769 | request = null;
770 | };
771 |
772 | // Handle timeout
773 | request.ontimeout = function handleTimeout() {
774 | reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
775 | request));
776 |
777 | // Clean up request
778 | request = null;
779 | };
780 |
781 | // Add xsrf header
782 | // This is only done if running in a standard browser environment.
783 | // Specifically not if we're in a web worker, or react-native.
784 | if (utils.isStandardBrowserEnv()) {
785 | var cookies = __webpack_require__(16);
786 |
787 | // Add xsrf header
788 | var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
789 | cookies.read(config.xsrfCookieName) :
790 | undefined;
791 |
792 | if (xsrfValue) {
793 | requestHeaders[config.xsrfHeaderName] = xsrfValue;
794 | }
795 | }
796 |
797 | // Add headers to the request
798 | if ('setRequestHeader' in request) {
799 | utils.forEach(requestHeaders, function setRequestHeader(val, key) {
800 | if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
801 | // Remove Content-Type if data is undefined
802 | delete requestHeaders[key];
803 | } else {
804 | // Otherwise add header to the request
805 | request.setRequestHeader(key, val);
806 | }
807 | });
808 | }
809 |
810 | // Add withCredentials to request if needed
811 | if (config.withCredentials) {
812 | request.withCredentials = true;
813 | }
814 |
815 | // Add responseType to request if needed
816 | if (config.responseType) {
817 | try {
818 | request.responseType = config.responseType;
819 | } catch (e) {
820 | // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
821 | // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
822 | if (config.responseType !== 'json') {
823 | throw e;
824 | }
825 | }
826 | }
827 |
828 | // Handle progress if needed
829 | if (typeof config.onDownloadProgress === 'function') {
830 | request.addEventListener('progress', config.onDownloadProgress);
831 | }
832 |
833 | // Not all browsers support upload events
834 | if (typeof config.onUploadProgress === 'function' && request.upload) {
835 | request.upload.addEventListener('progress', config.onUploadProgress);
836 | }
837 |
838 | if (config.cancelToken) {
839 | // Handle cancellation
840 | config.cancelToken.promise.then(function onCanceled(cancel) {
841 | if (!request) {
842 | return;
843 | }
844 |
845 | request.abort();
846 | reject(cancel);
847 | // Clean up request
848 | request = null;
849 | });
850 | }
851 |
852 | if (requestData === undefined) {
853 | requestData = null;
854 | }
855 |
856 | // Send the request
857 | request.send(requestData);
858 | });
859 | };
860 |
861 |
862 | /***/ }),
863 | /* 9 */
864 | /***/ (function(module, exports, __webpack_require__) {
865 |
866 | 'use strict';
867 |
868 | var createError = __webpack_require__(10);
869 |
870 | /**
871 | * Resolve or reject a Promise based on response status.
872 | *
873 | * @param {Function} resolve A function that resolves the promise.
874 | * @param {Function} reject A function that rejects the promise.
875 | * @param {object} response The response.
876 | */
877 | module.exports = function settle(resolve, reject, response) {
878 | var validateStatus = response.config.validateStatus;
879 | // Note: status is not exposed by XDomainRequest
880 | if (!response.status || !validateStatus || validateStatus(response.status)) {
881 | resolve(response);
882 | } else {
883 | reject(createError(
884 | 'Request failed with status code ' + response.status,
885 | response.config,
886 | null,
887 | response.request,
888 | response
889 | ));
890 | }
891 | };
892 |
893 |
894 | /***/ }),
895 | /* 10 */
896 | /***/ (function(module, exports, __webpack_require__) {
897 |
898 | 'use strict';
899 |
900 | var enhanceError = __webpack_require__(11);
901 |
902 | /**
903 | * Create an Error with the specified message, config, error code, request and response.
904 | *
905 | * @param {string} message The error message.
906 | * @param {Object} config The config.
907 | * @param {string} [code] The error code (for example, 'ECONNABORTED').
908 | * @param {Object} [request] The request.
909 | * @param {Object} [response] The response.
910 | * @returns {Error} The created error.
911 | */
912 | module.exports = function createError(message, config, code, request, response) {
913 | var error = new Error(message);
914 | return enhanceError(error, config, code, request, response);
915 | };
916 |
917 |
918 | /***/ }),
919 | /* 11 */
920 | /***/ (function(module, exports) {
921 |
922 | 'use strict';
923 |
924 | /**
925 | * Update an Error with the specified config, error code, and response.
926 | *
927 | * @param {Error} error The error to update.
928 | * @param {Object} config The config.
929 | * @param {string} [code] The error code (for example, 'ECONNABORTED').
930 | * @param {Object} [request] The request.
931 | * @param {Object} [response] The response.
932 | * @returns {Error} The error.
933 | */
934 | module.exports = function enhanceError(error, config, code, request, response) {
935 | error.config = config;
936 | if (code) {
937 | error.code = code;
938 | }
939 | error.request = request;
940 | error.response = response;
941 | return error;
942 | };
943 |
944 |
945 | /***/ }),
946 | /* 12 */
947 | /***/ (function(module, exports, __webpack_require__) {
948 |
949 | 'use strict';
950 |
951 | var utils = __webpack_require__(2);
952 |
953 | function encode(val) {
954 | return encodeURIComponent(val).
955 | replace(/%40/gi, '@').
956 | replace(/%3A/gi, ':').
957 | replace(/%24/g, '$').
958 | replace(/%2C/gi, ',').
959 | replace(/%20/g, '+').
960 | replace(/%5B/gi, '[').
961 | replace(/%5D/gi, ']');
962 | }
963 |
964 | /**
965 | * Build a URL by appending params to the end
966 | *
967 | * @param {string} url The base of the url (e.g., http://www.google.com)
968 | * @param {object} [params] The params to be appended
969 | * @returns {string} The formatted url
970 | */
971 | module.exports = function buildURL(url, params, paramsSerializer) {
972 | /*eslint no-param-reassign:0*/
973 | if (!params) {
974 | return url;
975 | }
976 |
977 | var serializedParams;
978 | if (paramsSerializer) {
979 | serializedParams = paramsSerializer(params);
980 | } else if (utils.isURLSearchParams(params)) {
981 | serializedParams = params.toString();
982 | } else {
983 | var parts = [];
984 |
985 | utils.forEach(params, function serialize(val, key) {
986 | if (val === null || typeof val === 'undefined') {
987 | return;
988 | }
989 |
990 | if (utils.isArray(val)) {
991 | key = key + '[]';
992 | } else {
993 | val = [val];
994 | }
995 |
996 | utils.forEach(val, function parseValue(v) {
997 | if (utils.isDate(v)) {
998 | v = v.toISOString();
999 | } else if (utils.isObject(v)) {
1000 | v = JSON.stringify(v);
1001 | }
1002 | parts.push(encode(key) + '=' + encode(v));
1003 | });
1004 | });
1005 |
1006 | serializedParams = parts.join('&');
1007 | }
1008 |
1009 | if (serializedParams) {
1010 | url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1011 | }
1012 |
1013 | return url;
1014 | };
1015 |
1016 |
1017 | /***/ }),
1018 | /* 13 */
1019 | /***/ (function(module, exports, __webpack_require__) {
1020 |
1021 | 'use strict';
1022 |
1023 | var utils = __webpack_require__(2);
1024 |
1025 | // Headers whose duplicates are ignored by node
1026 | // c.f. https://nodejs.org/api/http.html#http_message_headers
1027 | var ignoreDuplicateOf = [
1028 | 'age', 'authorization', 'content-length', 'content-type', 'etag',
1029 | 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1030 | 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1031 | 'referer', 'retry-after', 'user-agent'
1032 | ];
1033 |
1034 | /**
1035 | * Parse headers into an object
1036 | *
1037 | * ```
1038 | * Date: Wed, 27 Aug 2014 08:58:49 GMT
1039 | * Content-Type: application/json
1040 | * Connection: keep-alive
1041 | * Transfer-Encoding: chunked
1042 | * ```
1043 | *
1044 | * @param {String} headers Headers needing to be parsed
1045 | * @returns {Object} Headers parsed into an object
1046 | */
1047 | module.exports = function parseHeaders(headers) {
1048 | var parsed = {};
1049 | var key;
1050 | var val;
1051 | var i;
1052 |
1053 | if (!headers) { return parsed; }
1054 |
1055 | utils.forEach(headers.split('\n'), function parser(line) {
1056 | i = line.indexOf(':');
1057 | key = utils.trim(line.substr(0, i)).toLowerCase();
1058 | val = utils.trim(line.substr(i + 1));
1059 |
1060 | if (key) {
1061 | if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
1062 | return;
1063 | }
1064 | if (key === 'set-cookie') {
1065 | parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
1066 | } else {
1067 | parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1068 | }
1069 | }
1070 | });
1071 |
1072 | return parsed;
1073 | };
1074 |
1075 |
1076 | /***/ }),
1077 | /* 14 */
1078 | /***/ (function(module, exports, __webpack_require__) {
1079 |
1080 | 'use strict';
1081 |
1082 | var utils = __webpack_require__(2);
1083 |
1084 | module.exports = (
1085 | utils.isStandardBrowserEnv() ?
1086 |
1087 | // Standard browser envs have full support of the APIs needed to test
1088 | // whether the request URL is of the same origin as current location.
1089 | (function standardBrowserEnv() {
1090 | var msie = /(msie|trident)/i.test(navigator.userAgent);
1091 | var urlParsingNode = document.createElement('a');
1092 | var originURL;
1093 |
1094 | /**
1095 | * Parse a URL to discover it's components
1096 | *
1097 | * @param {String} url The URL to be parsed
1098 | * @returns {Object}
1099 | */
1100 | function resolveURL(url) {
1101 | var href = url;
1102 |
1103 | if (msie) {
1104 | // IE needs attribute set twice to normalize properties
1105 | urlParsingNode.setAttribute('href', href);
1106 | href = urlParsingNode.href;
1107 | }
1108 |
1109 | urlParsingNode.setAttribute('href', href);
1110 |
1111 | // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1112 | return {
1113 | href: urlParsingNode.href,
1114 | protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1115 | host: urlParsingNode.host,
1116 | search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1117 | hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1118 | hostname: urlParsingNode.hostname,
1119 | port: urlParsingNode.port,
1120 | pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
1121 | urlParsingNode.pathname :
1122 | '/' + urlParsingNode.pathname
1123 | };
1124 | }
1125 |
1126 | originURL = resolveURL(window.location.href);
1127 |
1128 | /**
1129 | * Determine if a URL shares the same origin as the current location
1130 | *
1131 | * @param {String} requestURL The URL to test
1132 | * @returns {boolean} True if URL shares the same origin, otherwise false
1133 | */
1134 | return function isURLSameOrigin(requestURL) {
1135 | var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
1136 | return (parsed.protocol === originURL.protocol &&
1137 | parsed.host === originURL.host);
1138 | };
1139 | })() :
1140 |
1141 | // Non standard browser envs (web workers, react-native) lack needed support.
1142 | (function nonStandardBrowserEnv() {
1143 | return function isURLSameOrigin() {
1144 | return true;
1145 | };
1146 | })()
1147 | );
1148 |
1149 |
1150 | /***/ }),
1151 | /* 15 */
1152 | /***/ (function(module, exports) {
1153 |
1154 | 'use strict';
1155 |
1156 | // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
1157 |
1158 | var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
1159 |
1160 | function E() {
1161 | this.message = 'String contains an invalid character';
1162 | }
1163 | E.prototype = new Error;
1164 | E.prototype.code = 5;
1165 | E.prototype.name = 'InvalidCharacterError';
1166 |
1167 | function btoa(input) {
1168 | var str = String(input);
1169 | var output = '';
1170 | for (
1171 | // initialize result and counter
1172 | var block, charCode, idx = 0, map = chars;
1173 | // if the next str index does not exist:
1174 | // change the mapping table to "="
1175 | // check if d has no fractional digits
1176 | str.charAt(idx | 0) || (map = '=', idx % 1);
1177 | // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
1178 | output += map.charAt(63 & block >> 8 - idx % 1 * 8)
1179 | ) {
1180 | charCode = str.charCodeAt(idx += 3 / 4);
1181 | if (charCode > 0xFF) {
1182 | throw new E();
1183 | }
1184 | block = block << 8 | charCode;
1185 | }
1186 | return output;
1187 | }
1188 |
1189 | module.exports = btoa;
1190 |
1191 |
1192 | /***/ }),
1193 | /* 16 */
1194 | /***/ (function(module, exports, __webpack_require__) {
1195 |
1196 | 'use strict';
1197 |
1198 | var utils = __webpack_require__(2);
1199 |
1200 | module.exports = (
1201 | utils.isStandardBrowserEnv() ?
1202 |
1203 | // Standard browser envs support document.cookie
1204 | (function standardBrowserEnv() {
1205 | return {
1206 | write: function write(name, value, expires, path, domain, secure) {
1207 | var cookie = [];
1208 | cookie.push(name + '=' + encodeURIComponent(value));
1209 |
1210 | if (utils.isNumber(expires)) {
1211 | cookie.push('expires=' + new Date(expires).toGMTString());
1212 | }
1213 |
1214 | if (utils.isString(path)) {
1215 | cookie.push('path=' + path);
1216 | }
1217 |
1218 | if (utils.isString(domain)) {
1219 | cookie.push('domain=' + domain);
1220 | }
1221 |
1222 | if (secure === true) {
1223 | cookie.push('secure');
1224 | }
1225 |
1226 | document.cookie = cookie.join('; ');
1227 | },
1228 |
1229 | read: function read(name) {
1230 | var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1231 | return (match ? decodeURIComponent(match[3]) : null);
1232 | },
1233 |
1234 | remove: function remove(name) {
1235 | this.write(name, '', Date.now() - 86400000);
1236 | }
1237 | };
1238 | })() :
1239 |
1240 | // Non standard browser env (web workers, react-native) lack needed support.
1241 | (function nonStandardBrowserEnv() {
1242 | return {
1243 | write: function write() {},
1244 | read: function read() { return null; },
1245 | remove: function remove() {}
1246 | };
1247 | })()
1248 | );
1249 |
1250 |
1251 | /***/ }),
1252 | /* 17 */
1253 | /***/ (function(module, exports, __webpack_require__) {
1254 |
1255 | 'use strict';
1256 |
1257 | var utils = __webpack_require__(2);
1258 |
1259 | function InterceptorManager() {
1260 | this.handlers = [];
1261 | }
1262 |
1263 | /**
1264 | * Add a new interceptor to the stack
1265 | *
1266 | * @param {Function} fulfilled The function to handle `then` for a `Promise`
1267 | * @param {Function} rejected The function to handle `reject` for a `Promise`
1268 | *
1269 | * @return {Number} An ID used to remove interceptor later
1270 | */
1271 | InterceptorManager.prototype.use = function use(fulfilled, rejected) {
1272 | this.handlers.push({
1273 | fulfilled: fulfilled,
1274 | rejected: rejected
1275 | });
1276 | return this.handlers.length - 1;
1277 | };
1278 |
1279 | /**
1280 | * Remove an interceptor from the stack
1281 | *
1282 | * @param {Number} id The ID that was returned by `use`
1283 | */
1284 | InterceptorManager.prototype.eject = function eject(id) {
1285 | if (this.handlers[id]) {
1286 | this.handlers[id] = null;
1287 | }
1288 | };
1289 |
1290 | /**
1291 | * Iterate over all the registered interceptors
1292 | *
1293 | * This method is particularly useful for skipping over any
1294 | * interceptors that may have become `null` calling `eject`.
1295 | *
1296 | * @param {Function} fn The function to call for each interceptor
1297 | */
1298 | InterceptorManager.prototype.forEach = function forEach(fn) {
1299 | utils.forEach(this.handlers, function forEachHandler(h) {
1300 | if (h !== null) {
1301 | fn(h);
1302 | }
1303 | });
1304 | };
1305 |
1306 | module.exports = InterceptorManager;
1307 |
1308 |
1309 | /***/ }),
1310 | /* 18 */
1311 | /***/ (function(module, exports, __webpack_require__) {
1312 |
1313 | 'use strict';
1314 |
1315 | var utils = __webpack_require__(2);
1316 | var transformData = __webpack_require__(19);
1317 | var isCancel = __webpack_require__(20);
1318 | var defaults = __webpack_require__(6);
1319 | var isAbsoluteURL = __webpack_require__(21);
1320 | var combineURLs = __webpack_require__(22);
1321 |
1322 | /**
1323 | * Throws a `Cancel` if cancellation has been requested.
1324 | */
1325 | function throwIfCancellationRequested(config) {
1326 | if (config.cancelToken) {
1327 | config.cancelToken.throwIfRequested();
1328 | }
1329 | }
1330 |
1331 | /**
1332 | * Dispatch a request to the server using the configured adapter.
1333 | *
1334 | * @param {object} config The config that is to be used for the request
1335 | * @returns {Promise} The Promise to be fulfilled
1336 | */
1337 | module.exports = function dispatchRequest(config) {
1338 | throwIfCancellationRequested(config);
1339 |
1340 | // Support baseURL config
1341 | if (config.baseURL && !isAbsoluteURL(config.url)) {
1342 | config.url = combineURLs(config.baseURL, config.url);
1343 | }
1344 |
1345 | // Ensure headers exist
1346 | config.headers = config.headers || {};
1347 |
1348 | // Transform request data
1349 | config.data = transformData(
1350 | config.data,
1351 | config.headers,
1352 | config.transformRequest
1353 | );
1354 |
1355 | // Flatten headers
1356 | config.headers = utils.merge(
1357 | config.headers.common || {},
1358 | config.headers[config.method] || {},
1359 | config.headers || {}
1360 | );
1361 |
1362 | utils.forEach(
1363 | ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
1364 | function cleanHeaderConfig(method) {
1365 | delete config.headers[method];
1366 | }
1367 | );
1368 |
1369 | var adapter = config.adapter || defaults.adapter;
1370 |
1371 | return adapter(config).then(function onAdapterResolution(response) {
1372 | throwIfCancellationRequested(config);
1373 |
1374 | // Transform response data
1375 | response.data = transformData(
1376 | response.data,
1377 | response.headers,
1378 | config.transformResponse
1379 | );
1380 |
1381 | return response;
1382 | }, function onAdapterRejection(reason) {
1383 | if (!isCancel(reason)) {
1384 | throwIfCancellationRequested(config);
1385 |
1386 | // Transform response data
1387 | if (reason && reason.response) {
1388 | reason.response.data = transformData(
1389 | reason.response.data,
1390 | reason.response.headers,
1391 | config.transformResponse
1392 | );
1393 | }
1394 | }
1395 |
1396 | return Promise.reject(reason);
1397 | });
1398 | };
1399 |
1400 |
1401 | /***/ }),
1402 | /* 19 */
1403 | /***/ (function(module, exports, __webpack_require__) {
1404 |
1405 | 'use strict';
1406 |
1407 | var utils = __webpack_require__(2);
1408 |
1409 | /**
1410 | * Transform the data for a request or a response
1411 | *
1412 | * @param {Object|String} data The data to be transformed
1413 | * @param {Array} headers The headers for the request or response
1414 | * @param {Array|Function} fns A single function or Array of functions
1415 | * @returns {*} The resulting transformed data
1416 | */
1417 | module.exports = function transformData(data, headers, fns) {
1418 | /*eslint no-param-reassign:0*/
1419 | utils.forEach(fns, function transform(fn) {
1420 | data = fn(data, headers);
1421 | });
1422 |
1423 | return data;
1424 | };
1425 |
1426 |
1427 | /***/ }),
1428 | /* 20 */
1429 | /***/ (function(module, exports) {
1430 |
1431 | 'use strict';
1432 |
1433 | module.exports = function isCancel(value) {
1434 | return !!(value && value.__CANCEL__);
1435 | };
1436 |
1437 |
1438 | /***/ }),
1439 | /* 21 */
1440 | /***/ (function(module, exports) {
1441 |
1442 | 'use strict';
1443 |
1444 | /**
1445 | * Determines whether the specified URL is absolute
1446 | *
1447 | * @param {string} url The URL to test
1448 | * @returns {boolean} True if the specified URL is absolute, otherwise false
1449 | */
1450 | module.exports = function isAbsoluteURL(url) {
1451 | // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL).
1452 | // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1453 | // by any combination of letters, digits, plus, period, or hyphen.
1454 | return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
1455 | };
1456 |
1457 |
1458 | /***/ }),
1459 | /* 22 */
1460 | /***/ (function(module, exports) {
1461 |
1462 | 'use strict';
1463 |
1464 | /**
1465 | * Creates a new URL by combining the specified URLs
1466 | *
1467 | * @param {string} baseURL The base URL
1468 | * @param {string} relativeURL The relative URL
1469 | * @returns {string} The combined URL
1470 | */
1471 | module.exports = function combineURLs(baseURL, relativeURL) {
1472 | return relativeURL
1473 | ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1474 | : baseURL;
1475 | };
1476 |
1477 |
1478 | /***/ }),
1479 | /* 23 */
1480 | /***/ (function(module, exports) {
1481 |
1482 | 'use strict';
1483 |
1484 | /**
1485 | * A `Cancel` is an object that is thrown when an operation is canceled.
1486 | *
1487 | * @class
1488 | * @param {string=} message The message.
1489 | */
1490 | function Cancel(message) {
1491 | this.message = message;
1492 | }
1493 |
1494 | Cancel.prototype.toString = function toString() {
1495 | return 'Cancel' + (this.message ? ': ' + this.message : '');
1496 | };
1497 |
1498 | Cancel.prototype.__CANCEL__ = true;
1499 |
1500 | module.exports = Cancel;
1501 |
1502 |
1503 | /***/ }),
1504 | /* 24 */
1505 | /***/ (function(module, exports, __webpack_require__) {
1506 |
1507 | 'use strict';
1508 |
1509 | var Cancel = __webpack_require__(23);
1510 |
1511 | /**
1512 | * A `CancelToken` is an object that can be used to request cancellation of an operation.
1513 | *
1514 | * @class
1515 | * @param {Function} executor The executor function.
1516 | */
1517 | function CancelToken(executor) {
1518 | if (typeof executor !== 'function') {
1519 | throw new TypeError('executor must be a function.');
1520 | }
1521 |
1522 | var resolvePromise;
1523 | this.promise = new Promise(function promiseExecutor(resolve) {
1524 | resolvePromise = resolve;
1525 | });
1526 |
1527 | var token = this;
1528 | executor(function cancel(message) {
1529 | if (token.reason) {
1530 | // Cancellation has already been requested
1531 | return;
1532 | }
1533 |
1534 | token.reason = new Cancel(message);
1535 | resolvePromise(token.reason);
1536 | });
1537 | }
1538 |
1539 | /**
1540 | * Throws a `Cancel` if cancellation has been requested.
1541 | */
1542 | CancelToken.prototype.throwIfRequested = function throwIfRequested() {
1543 | if (this.reason) {
1544 | throw this.reason;
1545 | }
1546 | };
1547 |
1548 | /**
1549 | * Returns an object that contains a new `CancelToken` and a function that, when called,
1550 | * cancels the `CancelToken`.
1551 | */
1552 | CancelToken.source = function source() {
1553 | var cancel;
1554 | var token = new CancelToken(function executor(c) {
1555 | cancel = c;
1556 | });
1557 | return {
1558 | token: token,
1559 | cancel: cancel
1560 | };
1561 | };
1562 |
1563 | module.exports = CancelToken;
1564 |
1565 |
1566 | /***/ }),
1567 | /* 25 */
1568 | /***/ (function(module, exports) {
1569 |
1570 | 'use strict';
1571 |
1572 | /**
1573 | * Syntactic sugar for invoking a function and expanding an array for arguments.
1574 | *
1575 | * Common use case would be to use `Function.prototype.apply`.
1576 | *
1577 | * ```js
1578 | * function f(x, y, z) {}
1579 | * var args = [1, 2, 3];
1580 | * f.apply(null, args);
1581 | * ```
1582 | *
1583 | * With `spread` this example can be re-written.
1584 | *
1585 | * ```js
1586 | * spread(function(x, y, z) {})([1, 2, 3]);
1587 | * ```
1588 | *
1589 | * @param {Function} callback
1590 | * @returns {Function}
1591 | */
1592 | module.exports = function spread(callback) {
1593 | return function wrap(arr) {
1594 | return callback.apply(null, arr);
1595 | };
1596 | };
1597 |
1598 |
1599 | /***/ })
1600 | /******/ ])
1601 | });
1602 | ;
1603 | //# sourceMappingURL=axios.map
--------------------------------------------------------------------------------
/跨域问题/iframe+window.name/empty/proxy.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/跨域问题/iframe+window.name/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/跨域问题/iframe+window.name/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "window.name",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "accepts": {
8 | "version": "1.3.5",
9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
10 | "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
11 | "dev": true,
12 | "requires": {
13 | "mime-types": "~2.1.18",
14 | "negotiator": "0.6.1"
15 | }
16 | },
17 | "array-flatten": {
18 | "version": "1.1.1",
19 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
20 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
21 | "dev": true
22 | },
23 | "asynckit": {
24 | "version": "0.4.0",
25 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
26 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
27 | },
28 | "axios": {
29 | "version": "1.6.5",
30 | "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz",
31 | "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==",
32 | "requires": {
33 | "follow-redirects": "^1.15.4",
34 | "form-data": "^4.0.0",
35 | "proxy-from-env": "^1.1.0"
36 | }
37 | },
38 | "body-parser": {
39 | "version": "1.18.2",
40 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz",
41 | "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=",
42 | "dev": true,
43 | "requires": {
44 | "bytes": "3.0.0",
45 | "content-type": "~1.0.4",
46 | "debug": "2.6.9",
47 | "depd": "~1.1.1",
48 | "http-errors": "~1.6.2",
49 | "iconv-lite": "0.4.19",
50 | "on-finished": "~2.3.0",
51 | "qs": "6.5.1",
52 | "raw-body": "2.3.2",
53 | "type-is": "~1.6.15"
54 | }
55 | },
56 | "bytes": {
57 | "version": "3.0.0",
58 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
59 | "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=",
60 | "dev": true
61 | },
62 | "combined-stream": {
63 | "version": "1.0.8",
64 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
65 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
66 | "requires": {
67 | "delayed-stream": "~1.0.0"
68 | }
69 | },
70 | "content-disposition": {
71 | "version": "0.5.2",
72 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
73 | "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=",
74 | "dev": true
75 | },
76 | "content-type": {
77 | "version": "1.0.4",
78 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
79 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
80 | "dev": true
81 | },
82 | "cookie": {
83 | "version": "0.3.1",
84 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
85 | "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=",
86 | "dev": true
87 | },
88 | "cookie-signature": {
89 | "version": "1.0.6",
90 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
91 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=",
92 | "dev": true
93 | },
94 | "debug": {
95 | "version": "2.6.9",
96 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
97 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
98 | "dev": true,
99 | "requires": {
100 | "ms": "2.0.0"
101 | }
102 | },
103 | "delayed-stream": {
104 | "version": "1.0.0",
105 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
106 | "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
107 | },
108 | "depd": {
109 | "version": "1.1.2",
110 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
111 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
112 | "dev": true
113 | },
114 | "destroy": {
115 | "version": "1.0.4",
116 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
117 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=",
118 | "dev": true
119 | },
120 | "ee-first": {
121 | "version": "1.1.1",
122 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
123 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
124 | "dev": true
125 | },
126 | "encodeurl": {
127 | "version": "1.0.2",
128 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
129 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
130 | "dev": true
131 | },
132 | "escape-html": {
133 | "version": "1.0.3",
134 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
135 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=",
136 | "dev": true
137 | },
138 | "etag": {
139 | "version": "1.8.1",
140 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
141 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
142 | "dev": true
143 | },
144 | "express": {
145 | "version": "4.16.3",
146 | "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz",
147 | "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=",
148 | "dev": true,
149 | "requires": {
150 | "accepts": "~1.3.5",
151 | "array-flatten": "1.1.1",
152 | "body-parser": "1.18.2",
153 | "content-disposition": "0.5.2",
154 | "content-type": "~1.0.4",
155 | "cookie": "0.3.1",
156 | "cookie-signature": "1.0.6",
157 | "debug": "2.6.9",
158 | "depd": "~1.1.2",
159 | "encodeurl": "~1.0.2",
160 | "escape-html": "~1.0.3",
161 | "etag": "~1.8.1",
162 | "finalhandler": "1.1.1",
163 | "fresh": "0.5.2",
164 | "merge-descriptors": "1.0.1",
165 | "methods": "~1.1.2",
166 | "on-finished": "~2.3.0",
167 | "parseurl": "~1.3.2",
168 | "path-to-regexp": "0.1.7",
169 | "proxy-addr": "~2.0.3",
170 | "qs": "6.5.1",
171 | "range-parser": "~1.2.0",
172 | "safe-buffer": "5.1.1",
173 | "send": "0.16.2",
174 | "serve-static": "1.13.2",
175 | "setprototypeof": "1.1.0",
176 | "statuses": "~1.4.0",
177 | "type-is": "~1.6.16",
178 | "utils-merge": "1.0.1",
179 | "vary": "~1.1.2"
180 | }
181 | },
182 | "finalhandler": {
183 | "version": "1.1.1",
184 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
185 | "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
186 | "dev": true,
187 | "requires": {
188 | "debug": "2.6.9",
189 | "encodeurl": "~1.0.2",
190 | "escape-html": "~1.0.3",
191 | "on-finished": "~2.3.0",
192 | "parseurl": "~1.3.2",
193 | "statuses": "~1.4.0",
194 | "unpipe": "~1.0.0"
195 | }
196 | },
197 | "follow-redirects": {
198 | "version": "1.15.4",
199 | "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
200 | "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw=="
201 | },
202 | "form-data": {
203 | "version": "4.0.0",
204 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
205 | "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
206 | "requires": {
207 | "asynckit": "^0.4.0",
208 | "combined-stream": "^1.0.8",
209 | "mime-types": "^2.1.12"
210 | }
211 | },
212 | "forwarded": {
213 | "version": "0.1.2",
214 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
215 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=",
216 | "dev": true
217 | },
218 | "fresh": {
219 | "version": "0.5.2",
220 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
221 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=",
222 | "dev": true
223 | },
224 | "http-errors": {
225 | "version": "1.6.3",
226 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
227 | "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
228 | "dev": true,
229 | "requires": {
230 | "depd": "~1.1.2",
231 | "inherits": "2.0.3",
232 | "setprototypeof": "1.1.0",
233 | "statuses": ">= 1.4.0 < 2"
234 | }
235 | },
236 | "iconv-lite": {
237 | "version": "0.4.19",
238 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz",
239 | "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==",
240 | "dev": true
241 | },
242 | "inherits": {
243 | "version": "2.0.3",
244 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
245 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
246 | "dev": true
247 | },
248 | "ipaddr.js": {
249 | "version": "1.6.0",
250 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz",
251 | "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=",
252 | "dev": true
253 | },
254 | "media-typer": {
255 | "version": "0.3.0",
256 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
257 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
258 | "dev": true
259 | },
260 | "merge-descriptors": {
261 | "version": "1.0.1",
262 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
263 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=",
264 | "dev": true
265 | },
266 | "methods": {
267 | "version": "1.1.2",
268 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
269 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=",
270 | "dev": true
271 | },
272 | "mime": {
273 | "version": "1.4.1",
274 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz",
275 | "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==",
276 | "dev": true
277 | },
278 | "mime-db": {
279 | "version": "1.33.0",
280 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
281 | "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ=="
282 | },
283 | "mime-types": {
284 | "version": "2.1.18",
285 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
286 | "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
287 | "requires": {
288 | "mime-db": "~1.33.0"
289 | }
290 | },
291 | "ms": {
292 | "version": "2.0.0",
293 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
294 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
295 | "dev": true
296 | },
297 | "negotiator": {
298 | "version": "0.6.1",
299 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
300 | "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=",
301 | "dev": true
302 | },
303 | "on-finished": {
304 | "version": "2.3.0",
305 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
306 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
307 | "dev": true,
308 | "requires": {
309 | "ee-first": "1.1.1"
310 | }
311 | },
312 | "parseurl": {
313 | "version": "1.3.2",
314 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz",
315 | "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=",
316 | "dev": true
317 | },
318 | "path-to-regexp": {
319 | "version": "0.1.7",
320 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
321 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=",
322 | "dev": true
323 | },
324 | "proxy-addr": {
325 | "version": "2.0.3",
326 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz",
327 | "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==",
328 | "dev": true,
329 | "requires": {
330 | "forwarded": "~0.1.2",
331 | "ipaddr.js": "1.6.0"
332 | }
333 | },
334 | "proxy-from-env": {
335 | "version": "1.1.0",
336 | "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
337 | "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
338 | },
339 | "qs": {
340 | "version": "6.5.1",
341 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz",
342 | "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==",
343 | "dev": true
344 | },
345 | "range-parser": {
346 | "version": "1.2.0",
347 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
348 | "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=",
349 | "dev": true
350 | },
351 | "raw-body": {
352 | "version": "2.3.2",
353 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz",
354 | "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=",
355 | "dev": true,
356 | "requires": {
357 | "bytes": "3.0.0",
358 | "http-errors": "1.6.2",
359 | "iconv-lite": "0.4.19",
360 | "unpipe": "1.0.0"
361 | },
362 | "dependencies": {
363 | "depd": {
364 | "version": "1.1.1",
365 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz",
366 | "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=",
367 | "dev": true
368 | },
369 | "http-errors": {
370 | "version": "1.6.2",
371 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz",
372 | "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=",
373 | "dev": true,
374 | "requires": {
375 | "depd": "1.1.1",
376 | "inherits": "2.0.3",
377 | "setprototypeof": "1.0.3",
378 | "statuses": ">= 1.3.1 < 2"
379 | }
380 | },
381 | "setprototypeof": {
382 | "version": "1.0.3",
383 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz",
384 | "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=",
385 | "dev": true
386 | }
387 | }
388 | },
389 | "safe-buffer": {
390 | "version": "5.1.1",
391 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
392 | "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
393 | "dev": true
394 | },
395 | "send": {
396 | "version": "0.16.2",
397 | "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz",
398 | "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
399 | "dev": true,
400 | "requires": {
401 | "debug": "2.6.9",
402 | "depd": "~1.1.2",
403 | "destroy": "~1.0.4",
404 | "encodeurl": "~1.0.2",
405 | "escape-html": "~1.0.3",
406 | "etag": "~1.8.1",
407 | "fresh": "0.5.2",
408 | "http-errors": "~1.6.2",
409 | "mime": "1.4.1",
410 | "ms": "2.0.0",
411 | "on-finished": "~2.3.0",
412 | "range-parser": "~1.2.0",
413 | "statuses": "~1.4.0"
414 | }
415 | },
416 | "serve-static": {
417 | "version": "1.13.2",
418 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
419 | "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==",
420 | "dev": true,
421 | "requires": {
422 | "encodeurl": "~1.0.2",
423 | "escape-html": "~1.0.3",
424 | "parseurl": "~1.3.2",
425 | "send": "0.16.2"
426 | }
427 | },
428 | "setprototypeof": {
429 | "version": "1.1.0",
430 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
431 | "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==",
432 | "dev": true
433 | },
434 | "statuses": {
435 | "version": "1.4.0",
436 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
437 | "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==",
438 | "dev": true
439 | },
440 | "type-is": {
441 | "version": "1.6.16",
442 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz",
443 | "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==",
444 | "dev": true,
445 | "requires": {
446 | "media-typer": "0.3.0",
447 | "mime-types": "~2.1.18"
448 | }
449 | },
450 | "unpipe": {
451 | "version": "1.0.0",
452 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
453 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
454 | "dev": true
455 | },
456 | "utils-merge": {
457 | "version": "1.0.1",
458 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
459 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=",
460 | "dev": true
461 | },
462 | "vary": {
463 | "version": "1.1.2",
464 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
465 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
466 | "dev": true
467 | }
468 | }
469 | }
470 |
--------------------------------------------------------------------------------
/跨域问题/iframe+window.name/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "window.name",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "devDependencies": {
7 | "express": "^4.16.3"
8 | },
9 | "dependencies": {
10 | "axios": "^1.6.5"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/跨域问题/iframe+window.name/server.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var app = express();
3 |
4 | // 定义路由
5 |
6 | var router = express.Router();
7 |
8 | router.get('/api/get',function(req,res){
9 | res.send(``);
12 | })
13 |
14 | app.use(router);
15 |
16 | var port = process.env.PORT || 8383;
17 |
18 | app.listen(port);
19 |
20 | console.log('Magic happens on port' + port);
--------------------------------------------------------------------------------
/跨域问题/iframe+window.name/yarn-error.log:
--------------------------------------------------------------------------------
1 | Arguments:
2 | C:\Program Files\nodejs\node.exe C:\Program Files (x86)\Yarn\bin\yarn.js add express
3 |
4 | PATH:
5 | C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Administrator\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin;C:\Program Files\Microsoft VS Code\bin;C:\Users\Administrator\AppData\Roaming\npm;C:\Users\Administrator\AppData\Local\Yarn\bin
6 |
7 | Yarn version:
8 | 1.7.0
9 |
10 | Node version:
11 | 10.5.0
12 |
13 | Platform:
14 | win32 x64
15 |
16 | Trace:
17 | Error: connect ETIMEDOUT 104.18.94.96:443
18 | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:14)
19 |
20 | npm manifest:
21 | {
22 | "name": "window.name",
23 | "version": "1.0.0",
24 | "main": "index.js",
25 | "license": "MIT"
26 | }
27 |
28 | yarn manifest:
29 | No manifest
30 |
31 | Lockfile:
32 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
33 | # yarn lockfile v1
34 |
--------------------------------------------------------------------------------
/跨域问题/iframe+window.name/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | accepts@~1.3.7:
6 | version "1.3.7"
7 | resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd"
8 | dependencies:
9 | mime-types "~2.1.24"
10 | negotiator "0.6.2"
11 |
12 | array-flatten@1.1.1:
13 | version "1.1.1"
14 | resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
15 |
16 | asynckit@^0.4.0:
17 | version "0.4.0"
18 | resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
19 |
20 | axios@^1.6.5:
21 | version "1.6.5"
22 | resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.5.tgz#2c090da14aeeab3770ad30c3a1461bc970fb0cd8"
23 | dependencies:
24 | follow-redirects "^1.15.4"
25 | form-data "^4.0.0"
26 | proxy-from-env "^1.1.0"
27 |
28 | body-parser@1.19.0:
29 | version "1.19.0"
30 | resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a"
31 | dependencies:
32 | bytes "3.1.0"
33 | content-type "~1.0.4"
34 | debug "2.6.9"
35 | depd "~1.1.2"
36 | http-errors "1.7.2"
37 | iconv-lite "0.4.24"
38 | on-finished "~2.3.0"
39 | qs "6.7.0"
40 | raw-body "2.4.0"
41 | type-is "~1.6.17"
42 |
43 | bytes@3.1.0:
44 | version "3.1.0"
45 | resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
46 |
47 | combined-stream@^1.0.8:
48 | version "1.0.8"
49 | resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
50 | dependencies:
51 | delayed-stream "~1.0.0"
52 |
53 | content-disposition@0.5.3:
54 | version "0.5.3"
55 | resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd"
56 | dependencies:
57 | safe-buffer "5.1.2"
58 |
59 | content-type@~1.0.4:
60 | version "1.0.4"
61 | resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b"
62 |
63 | cookie-signature@1.0.6:
64 | version "1.0.6"
65 | resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c"
66 |
67 | cookie@0.4.0:
68 | version "0.4.0"
69 | resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba"
70 |
71 | debug@2.6.9:
72 | version "2.6.9"
73 | resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
74 | dependencies:
75 | ms "2.0.0"
76 |
77 | delayed-stream@~1.0.0:
78 | version "1.0.0"
79 | resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
80 |
81 | depd@~1.1.2:
82 | version "1.1.2"
83 | resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9"
84 |
85 | destroy@~1.0.4:
86 | version "1.0.4"
87 | resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80"
88 |
89 | ee-first@1.1.1:
90 | version "1.1.1"
91 | resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
92 |
93 | encodeurl@~1.0.2:
94 | version "1.0.2"
95 | resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
96 |
97 | escape-html@~1.0.3:
98 | version "1.0.3"
99 | resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
100 |
101 | etag@~1.8.1:
102 | version "1.8.1"
103 | resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
104 |
105 | express@^4.16.3:
106 | version "4.17.1"
107 | resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134"
108 | dependencies:
109 | accepts "~1.3.7"
110 | array-flatten "1.1.1"
111 | body-parser "1.19.0"
112 | content-disposition "0.5.3"
113 | content-type "~1.0.4"
114 | cookie "0.4.0"
115 | cookie-signature "1.0.6"
116 | debug "2.6.9"
117 | depd "~1.1.2"
118 | encodeurl "~1.0.2"
119 | escape-html "~1.0.3"
120 | etag "~1.8.1"
121 | finalhandler "~1.1.2"
122 | fresh "0.5.2"
123 | merge-descriptors "1.0.1"
124 | methods "~1.1.2"
125 | on-finished "~2.3.0"
126 | parseurl "~1.3.3"
127 | path-to-regexp "0.1.7"
128 | proxy-addr "~2.0.5"
129 | qs "6.7.0"
130 | range-parser "~1.2.1"
131 | safe-buffer "5.1.2"
132 | send "0.17.1"
133 | serve-static "1.14.1"
134 | setprototypeof "1.1.1"
135 | statuses "~1.5.0"
136 | type-is "~1.6.18"
137 | utils-merge "1.0.1"
138 | vary "~1.1.2"
139 |
140 | finalhandler@~1.1.2:
141 | version "1.1.2"
142 | resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d"
143 | dependencies:
144 | debug "2.6.9"
145 | encodeurl "~1.0.2"
146 | escape-html "~1.0.3"
147 | on-finished "~2.3.0"
148 | parseurl "~1.3.3"
149 | statuses "~1.5.0"
150 | unpipe "~1.0.0"
151 |
152 | follow-redirects@^1.15.4:
153 | version "1.15.4"
154 | resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf"
155 |
156 | form-data@^4.0.0:
157 | version "4.0.0"
158 | resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
159 | dependencies:
160 | asynckit "^0.4.0"
161 | combined-stream "^1.0.8"
162 | mime-types "^2.1.12"
163 |
164 | forwarded@~0.1.2:
165 | version "0.1.2"
166 | resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
167 |
168 | fresh@0.5.2:
169 | version "0.5.2"
170 | resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
171 |
172 | http-errors@1.7.2:
173 | version "1.7.2"
174 | resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f"
175 | dependencies:
176 | depd "~1.1.2"
177 | inherits "2.0.3"
178 | setprototypeof "1.1.1"
179 | statuses ">= 1.5.0 < 2"
180 | toidentifier "1.0.0"
181 |
182 | http-errors@~1.7.2:
183 | version "1.7.3"
184 | resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06"
185 | dependencies:
186 | depd "~1.1.2"
187 | inherits "2.0.4"
188 | setprototypeof "1.1.1"
189 | statuses ">= 1.5.0 < 2"
190 | toidentifier "1.0.0"
191 |
192 | iconv-lite@0.4.24:
193 | version "0.4.24"
194 | resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
195 | dependencies:
196 | safer-buffer ">= 2.1.2 < 3"
197 |
198 | inherits@2.0.3:
199 | version "2.0.3"
200 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
201 |
202 | inherits@2.0.4:
203 | version "2.0.4"
204 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
205 |
206 | ipaddr.js@1.9.0:
207 | version "1.9.0"
208 | resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.0.tgz#37df74e430a0e47550fe54a2defe30d8acd95f65"
209 |
210 | media-typer@0.3.0:
211 | version "0.3.0"
212 | resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
213 |
214 | merge-descriptors@1.0.1:
215 | version "1.0.1"
216 | resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61"
217 |
218 | methods@~1.1.2:
219 | version "1.1.2"
220 | resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
221 |
222 | mime-db@1.40.0:
223 | version "1.40.0"
224 | resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32"
225 |
226 | mime-db@1.52.0:
227 | version "1.52.0"
228 | resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
229 |
230 | mime-types@^2.1.12:
231 | version "2.1.35"
232 | resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
233 | dependencies:
234 | mime-db "1.52.0"
235 |
236 | mime-types@~2.1.24:
237 | version "2.1.24"
238 | resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81"
239 | dependencies:
240 | mime-db "1.40.0"
241 |
242 | mime@1.6.0:
243 | version "1.6.0"
244 | resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
245 |
246 | ms@2.0.0:
247 | version "2.0.0"
248 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
249 |
250 | ms@2.1.1:
251 | version "2.1.1"
252 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
253 |
254 | negotiator@0.6.2:
255 | version "0.6.2"
256 | resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb"
257 |
258 | on-finished@~2.3.0:
259 | version "2.3.0"
260 | resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
261 | dependencies:
262 | ee-first "1.1.1"
263 |
264 | parseurl@~1.3.3:
265 | version "1.3.3"
266 | resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
267 |
268 | path-to-regexp@0.1.7:
269 | version "0.1.7"
270 | resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
271 |
272 | proxy-addr@~2.0.5:
273 | version "2.0.5"
274 | resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34"
275 | dependencies:
276 | forwarded "~0.1.2"
277 | ipaddr.js "1.9.0"
278 |
279 | proxy-from-env@^1.1.0:
280 | version "1.1.0"
281 | resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
282 |
283 | qs@6.7.0:
284 | version "6.7.0"
285 | resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"
286 |
287 | range-parser@~1.2.1:
288 | version "1.2.1"
289 | resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
290 |
291 | raw-body@2.4.0:
292 | version "2.4.0"
293 | resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332"
294 | dependencies:
295 | bytes "3.1.0"
296 | http-errors "1.7.2"
297 | iconv-lite "0.4.24"
298 | unpipe "1.0.0"
299 |
300 | safe-buffer@5.1.2:
301 | version "5.1.2"
302 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
303 |
304 | "safer-buffer@>= 2.1.2 < 3":
305 | version "2.1.2"
306 | resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
307 |
308 | send@0.17.1:
309 | version "0.17.1"
310 | resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8"
311 | dependencies:
312 | debug "2.6.9"
313 | depd "~1.1.2"
314 | destroy "~1.0.4"
315 | encodeurl "~1.0.2"
316 | escape-html "~1.0.3"
317 | etag "~1.8.1"
318 | fresh "0.5.2"
319 | http-errors "~1.7.2"
320 | mime "1.6.0"
321 | ms "2.1.1"
322 | on-finished "~2.3.0"
323 | range-parser "~1.2.1"
324 | statuses "~1.5.0"
325 |
326 | serve-static@1.14.1:
327 | version "1.14.1"
328 | resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9"
329 | dependencies:
330 | encodeurl "~1.0.2"
331 | escape-html "~1.0.3"
332 | parseurl "~1.3.3"
333 | send "0.17.1"
334 |
335 | setprototypeof@1.1.1:
336 | version "1.1.1"
337 | resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683"
338 |
339 | "statuses@>= 1.5.0 < 2", statuses@~1.5.0:
340 | version "1.5.0"
341 | resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
342 |
343 | toidentifier@1.0.0:
344 | version "1.0.0"
345 | resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"
346 |
347 | type-is@~1.6.17, type-is@~1.6.18:
348 | version "1.6.18"
349 | resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"
350 | dependencies:
351 | media-typer "0.3.0"
352 | mime-types "~2.1.24"
353 |
354 | unpipe@1.0.0, unpipe@~1.0.0:
355 | version "1.0.0"
356 | resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
357 |
358 | utils-merge@1.0.1:
359 | version "1.0.1"
360 | resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
361 |
362 | vary@~1.1.2:
363 | version "1.1.2"
364 | resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
365 |
--------------------------------------------------------------------------------
/跨域问题/jsonp/app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/跨域问题/jsonp/server/data.js:
--------------------------------------------------------------------------------
1 | // 不在同一域名的js 请使用http-server 启动一个服务 8081
2 | // 数据
3 | const data = {
4 | list:[
5 | {
6 | name:"data1",
7 | someOther:{}
8 | },
9 | {
10 | name:"data2",
11 | someOther:{}
12 | },
13 | {
14 | name:"data3",
15 | someOther:{}
16 | }
17 | ]
18 | }
19 |
20 | //调用 8080 下的 函数
21 | callBack(data); // 调用callback 函数传递数据 // callback目前是未定义的 但是index里面会定义好
22 |
--------------------------------------------------------------------------------