bigpipe-util 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -56
- package/LICENSE +19 -19
- package/README.md +3 -0
- package/bigpipe.svg +13 -13
- package/package.json +25 -25
- package/src/Primer.js +151 -134
- package/src/ServerJS.js +40 -40
- package/src/async/AsyncDOM.js +56 -56
- package/src/async/AsyncRequest.js +206 -206
- package/src/async/AsyncResponse.js +21 -21
- package/src/core/$.js +3 -3
- package/src/core/Arbiter.js +53 -0
- package/src/core/DOM.js +41 -41
- package/src/core/Dialog.js +135 -129
- package/src/core/Parent.js +38 -9
- package/src/core/ReloadPage.js +9 -9
- package/src/core/ServerRedirect.js +7 -7
- package/src/core/copyProperties.js +46 -46
- package/src/core/replaceTransportMarkers.js +27 -27
package/src/core/DOM.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
function removeNode(node) {
|
|
2
|
-
if (node.parentNode) {
|
|
3
|
-
node.parentNode.removeChild(node);
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
prependContent(node, content) {
|
|
9
|
-
node.insertAdjacentHTML("afterbegin", content);
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
insertAfter(node, content) {
|
|
13
|
-
node.insertAdjacentHTML("afterend", content);
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
insertBefore(node, content) {
|
|
17
|
-
node.insertAdjacentHTML("beforebegin", content);
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
setContent(node, content) {
|
|
21
|
-
node.innerHTML = content;
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
appendContent(node, content) {
|
|
25
|
-
node.insertAdjacentHTML("beforeend", content);
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
replace(node, content) {
|
|
29
|
-
node.outerHTML = content;
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
remove(node) {
|
|
33
|
-
removeNode(node);
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
empty(node) {
|
|
37
|
-
while (node.firstChild) {
|
|
38
|
-
removeNode(node.firstChild);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
function removeNode(node) {
|
|
2
|
+
if (node.parentNode) {
|
|
3
|
+
node.parentNode.removeChild(node);
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
prependContent(node, content) {
|
|
9
|
+
node.insertAdjacentHTML("afterbegin", content);
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
insertAfter(node, content) {
|
|
13
|
+
node.insertAdjacentHTML("afterend", content);
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
insertBefore(node, content) {
|
|
17
|
+
node.insertAdjacentHTML("beforebegin", content);
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
setContent(node, content) {
|
|
21
|
+
node.innerHTML = content;
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
appendContent(node, content) {
|
|
25
|
+
node.insertAdjacentHTML("beforeend", content);
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
replace(node, content) {
|
|
29
|
+
node.outerHTML = content;
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
remove(node) {
|
|
33
|
+
removeNode(node);
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
empty(node) {
|
|
37
|
+
while (node.firstChild) {
|
|
38
|
+
removeNode(node.firstChild);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/core/Dialog.js
CHANGED
|
@@ -1,129 +1,135 @@
|
|
|
1
|
-
import Modal from "modal-vanilla/lib/modal";
|
|
2
|
-
import DOM from "./DOM";
|
|
3
|
-
|
|
4
|
-
const DEFAULT_Z_INDEX = 1040;
|
|
5
|
-
|
|
6
|
-
let stack = [];
|
|
7
|
-
let dialogId = 1;
|
|
8
|
-
let zIndex;
|
|
9
|
-
let originalBodyPad = null;
|
|
10
|
-
|
|
11
|
-
Modal.prototype._handleKeydownEvent = function(event) {
|
|
12
|
-
if (event.which === 27 && this._options.keyboard) {
|
|
13
|
-
const currentModal = stack[stack.length - 1];
|
|
14
|
-
if (currentModal.el.isEqualNode(this.el)) {
|
|
15
|
-
this.emit('dismiss', this, event, null);
|
|
16
|
-
this.hide();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default class Dialog {
|
|
22
|
-
close() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
1
|
+
import Modal from "modal-vanilla/lib/modal";
|
|
2
|
+
import DOM from "./DOM";
|
|
3
|
+
|
|
4
|
+
const DEFAULT_Z_INDEX = 1040;
|
|
5
|
+
|
|
6
|
+
let stack = [];
|
|
7
|
+
let dialogId = 1;
|
|
8
|
+
let zIndex;
|
|
9
|
+
let originalBodyPad = null;
|
|
10
|
+
|
|
11
|
+
Modal.prototype._handleKeydownEvent = function(event) {
|
|
12
|
+
if (event.which === 27 && this._options.keyboard) {
|
|
13
|
+
const currentModal = stack[stack.length - 1];
|
|
14
|
+
if (currentModal.el.isEqualNode(this.el)) {
|
|
15
|
+
this.emit('dismiss', this, event, null);
|
|
16
|
+
this.hide();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default class Dialog {
|
|
22
|
+
close(limit = -1) {
|
|
23
|
+
let modals;
|
|
24
|
+
if (limit > -1) {
|
|
25
|
+
modals = stack.slice(-limit);
|
|
26
|
+
} else {
|
|
27
|
+
modals = stack
|
|
28
|
+
}
|
|
29
|
+
modals.forEach((dialog) => dialog.hide())
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
closeCurrent() {
|
|
33
|
+
const dialog = stack.pop();
|
|
34
|
+
|
|
35
|
+
if (dialog) {
|
|
36
|
+
dialog.hide();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
render(options, args) {
|
|
41
|
+
DOM.appendContent(document.body, this._makeDialog(options.content, options.dialogClassName));
|
|
42
|
+
|
|
43
|
+
dialogId++;
|
|
44
|
+
|
|
45
|
+
const dialog = this._show({
|
|
46
|
+
el: document.getElementById(this.id),
|
|
47
|
+
animate: options.animate !== null && options.animate !== undefined ? options.animate : false,
|
|
48
|
+
keyboard: options.keyboard !== null && options.keyboard !== undefined ? options.keyboard : true,
|
|
49
|
+
backdrop: options.backdrop !== null && options.backdrop !== undefined ? options.backdrop : true,
|
|
50
|
+
transition: options.transition !== null && options.transition !== undefined ? options.transition : 0,
|
|
51
|
+
backdropTransition: options.backdropTransition !== null && options.backdropTransition !== undefined ? options.backdropTransition : 0,
|
|
52
|
+
}, options.controller, args);
|
|
53
|
+
|
|
54
|
+
stack.push(dialog);
|
|
55
|
+
|
|
56
|
+
return dialog;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
showFromModel(model, args) {
|
|
60
|
+
const dialog = this._show({
|
|
61
|
+
title: model.title || '',
|
|
62
|
+
content: model.body,
|
|
63
|
+
footer: model.footer || false,
|
|
64
|
+
animate: model.animate !== null && model.animate !== undefined ? model.animate : false,
|
|
65
|
+
keyboard: model.keyboard !== null && model.keyboard !== undefined ? model.keyboard : true,
|
|
66
|
+
backdrop: model.backdrop !== null && model.backdrop !== undefined ? model.backdrop : true,
|
|
67
|
+
transition: model.transition !== null && model.transition !== undefined ? model.transition : 0,
|
|
68
|
+
backdropTransition: model.backdropTransition !== null && model.backdropTransition !== undefined ? model.backdropTransition : 0,
|
|
69
|
+
}, model.controller, args);
|
|
70
|
+
|
|
71
|
+
stack.push(dialog);
|
|
72
|
+
|
|
73
|
+
return dialog;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_show(options, controller, args) {
|
|
77
|
+
if (originalBodyPad === null) {
|
|
78
|
+
originalBodyPad = document.body.style.paddingRight;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const _modal = new Modal(options);
|
|
82
|
+
|
|
83
|
+
if (controller) {
|
|
84
|
+
if (typeof controller === 'string') {
|
|
85
|
+
(new (window.require(controller))(_modal, ...args));
|
|
86
|
+
} else if (typeof controller === 'function') {
|
|
87
|
+
controller(_modal, ...args);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const self = this;
|
|
92
|
+
|
|
93
|
+
return _modal.on('shown', function ({el}) {
|
|
94
|
+
zIndex = DEFAULT_Z_INDEX + (10 * stack.length);
|
|
95
|
+
el.style.zIndex = zIndex;
|
|
96
|
+
setTimeout(() => document.querySelector('.modal-backdrop').style.zIndex = zIndex - 1);
|
|
97
|
+
}).on('showBackdrop', this._fixBackdrop).on('hidden', function ({el}) {
|
|
98
|
+
stack = stack.filter((modal) => {
|
|
99
|
+
return ! modal.el.isEqualNode(el);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (stack.length) {
|
|
103
|
+
document.body.classList.add('modal-open');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
document.body.style.paddingRight = originalBodyPad;
|
|
107
|
+
|
|
108
|
+
zIndex -= 10;
|
|
109
|
+
self._fixBackdrop();
|
|
110
|
+
DOM.remove(el);
|
|
111
|
+
}).show();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
_fixBackdrop() {
|
|
115
|
+
const backdrops = document.querySelectorAll('.modal-backdrop');
|
|
116
|
+
let shown = false;
|
|
117
|
+
|
|
118
|
+
backdrops.forEach((backdrop, index) => {
|
|
119
|
+
if (shown || index > 0 && index === backdrops.length - 1) {
|
|
120
|
+
backdrop.style.display = 'none';
|
|
121
|
+
} else {
|
|
122
|
+
backdrop.style.zIndex = zIndex - 1;
|
|
123
|
+
backdrop.style.display = '';
|
|
124
|
+
shown = true;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
_makeDialog(content, dialogClassName) {
|
|
130
|
+
this.id = `js_${dialogId.toString(16)}`;
|
|
131
|
+
return `<div id="${this.id}" class="modal fade ${dialogClassName || ''}" tabindex="-1" role="dialog">
|
|
132
|
+
${content}
|
|
133
|
+
</div>`;
|
|
134
|
+
}
|
|
135
|
+
}
|
package/src/core/Parent.js
CHANGED
|
@@ -1,9 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import CSSCore from "fbjs/lib/CSSCore";
|
|
2
|
+
|
|
3
|
+
export function byTag(node, tagName) {
|
|
4
|
+
tagName = tagName.toUpperCase();
|
|
5
|
+
node = find(node, function (el) {
|
|
6
|
+
return el.nodeName === tagName;
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
return node instanceof Element ? node : null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function byClass(node, className) {
|
|
13
|
+
node = find(node, function (el) {
|
|
14
|
+
return el instanceof Element && CSSCore.hasClass(el, className);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return node instanceof Element ? node : null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function byAttribute(node, attribute) {
|
|
21
|
+
node = find(node, function (el) {
|
|
22
|
+
return el instanceof Element && el.hasAttribute(attribute);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return node instanceof Element ? node : null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function find(node, callback) {
|
|
29
|
+
while (node) {
|
|
30
|
+
if (callback(node)) {
|
|
31
|
+
return node;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
node = node.parentNode;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return null;
|
|
38
|
+
}
|
package/src/core/ReloadPage.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export default class ReloadPage {
|
|
2
|
-
now() {
|
|
3
|
-
window.location.reload();
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
delay(delay) {
|
|
7
|
-
setTimeout(this.now.bind(this), delay);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
export default class ReloadPage {
|
|
2
|
+
now() {
|
|
3
|
+
window.location.reload();
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
delay(delay) {
|
|
7
|
+
setTimeout(this.now.bind(this), delay);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export default class ServerRedirect {
|
|
2
|
-
redirectPageTo(url, delay = 0) {
|
|
3
|
-
setTimeout(function () {
|
|
4
|
-
window.location = url;
|
|
5
|
-
}, delay);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
export default class ServerRedirect {
|
|
2
|
+
redirectPageTo(url, delay = 0) {
|
|
3
|
+
setTimeout(function () {
|
|
4
|
+
window.location = url;
|
|
5
|
+
}, delay);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
-
*
|
|
9
|
-
* @providesModule copyProperties
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Copy properties from one or more objects (up to 5) into the first object.
|
|
15
|
-
* This is a shallow copy. It mutates the first object and also returns it.
|
|
16
|
-
*
|
|
17
|
-
* NOTE: `arguments` has a very significant performance penalty, which is why
|
|
18
|
-
* we don't support unlimited arguments.
|
|
19
|
-
*/
|
|
20
|
-
export default function copyProperties(obj, a, b, c, d, e, f) {
|
|
21
|
-
obj = obj || {};
|
|
22
|
-
|
|
23
|
-
if (__DEV__) {
|
|
24
|
-
if (f) {
|
|
25
|
-
throw new Error('Too many arguments passed to copyProperties');
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
var args = [a, b, c, d, e];
|
|
30
|
-
var ii = 0, v;
|
|
31
|
-
while (args[ii]) {
|
|
32
|
-
v = args[ii++];
|
|
33
|
-
for (var k in v) {
|
|
34
|
-
obj[k] = v[k];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// IE ignores toString in object iteration.. See:
|
|
38
|
-
// webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html
|
|
39
|
-
if (v.hasOwnProperty && v.hasOwnProperty('toString') &&
|
|
40
|
-
(typeof v.toString !== 'undefined') && (obj.toString !== v.toString)) {
|
|
41
|
-
obj.toString = v.toString;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return obj;
|
|
46
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*
|
|
9
|
+
* @providesModule copyProperties
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Copy properties from one or more objects (up to 5) into the first object.
|
|
15
|
+
* This is a shallow copy. It mutates the first object and also returns it.
|
|
16
|
+
*
|
|
17
|
+
* NOTE: `arguments` has a very significant performance penalty, which is why
|
|
18
|
+
* we don't support unlimited arguments.
|
|
19
|
+
*/
|
|
20
|
+
export default function copyProperties(obj, a, b, c, d, e, f) {
|
|
21
|
+
obj = obj || {};
|
|
22
|
+
|
|
23
|
+
if (__DEV__) {
|
|
24
|
+
if (f) {
|
|
25
|
+
throw new Error('Too many arguments passed to copyProperties');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var args = [a, b, c, d, e];
|
|
30
|
+
var ii = 0, v;
|
|
31
|
+
while (args[ii]) {
|
|
32
|
+
v = args[ii++];
|
|
33
|
+
for (var k in v) {
|
|
34
|
+
obj[k] = v[k];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// IE ignores toString in object iteration.. See:
|
|
38
|
+
// webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html
|
|
39
|
+
if (v.hasOwnProperty && v.hasOwnProperty('toString') &&
|
|
40
|
+
(typeof v.toString !== 'undefined') && (obj.toString !== v.toString)) {
|
|
41
|
+
obj.toString = v.toString;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return obj;
|
|
46
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import $ from './$';
|
|
2
|
-
|
|
3
|
-
export default function replaceTransportMarkers(markerValue, markers, key) {
|
|
4
|
-
const marker = typeof key !== "undefined" ? markers[key] : markers;
|
|
5
|
-
|
|
6
|
-
if (Array.isArray(marker)) {
|
|
7
|
-
for (let i = 0; i < marker.length; i++) {
|
|
8
|
-
replaceTransportMarkers(markerValue, marker, i);
|
|
9
|
-
}
|
|
10
|
-
} else {
|
|
11
|
-
if (marker && typeof marker == "object") {
|
|
12
|
-
if (marker.__m) {
|
|
13
|
-
markers[key] = window.require(marker.__m);
|
|
14
|
-
} else if (marker.__e) {
|
|
15
|
-
markers[key] = $(marker.__e);
|
|
16
|
-
} else if (marker.__map) {
|
|
17
|
-
markers[key] = new Map(marker.__map);
|
|
18
|
-
} else if (marker.__set) {
|
|
19
|
-
markers[key] = new Set(marker.__set);
|
|
20
|
-
} else {
|
|
21
|
-
for (let value in marker) {
|
|
22
|
-
replaceTransportMarkers(markerValue, marker, value);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
import $ from './$';
|
|
2
|
+
|
|
3
|
+
export default function replaceTransportMarkers(markerValue, markers, key) {
|
|
4
|
+
const marker = typeof key !== "undefined" ? markers[key] : markers;
|
|
5
|
+
|
|
6
|
+
if (Array.isArray(marker)) {
|
|
7
|
+
for (let i = 0; i < marker.length; i++) {
|
|
8
|
+
replaceTransportMarkers(markerValue, marker, i);
|
|
9
|
+
}
|
|
10
|
+
} else {
|
|
11
|
+
if (marker && typeof marker == "object") {
|
|
12
|
+
if (marker.__m) {
|
|
13
|
+
markers[key] = window.require(marker.__m);
|
|
14
|
+
} else if (marker.__e) {
|
|
15
|
+
markers[key] = $(marker.__e);
|
|
16
|
+
} else if (marker.__map) {
|
|
17
|
+
markers[key] = new Map(marker.__map);
|
|
18
|
+
} else if (marker.__set) {
|
|
19
|
+
markers[key] = new Set(marker.__set);
|
|
20
|
+
} else {
|
|
21
|
+
for (let value in marker) {
|
|
22
|
+
replaceTransportMarkers(markerValue, marker, value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|