-
Notifications
You must be signed in to change notification settings - Fork 0
/
methods.js
53 lines (48 loc) · 1.3 KB
/
methods.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
let argumentsMap = args => {
let obj = {
bigint : [], boolean : [], function : [], number : [],
object : [], string : [], symbol : [], undefined : []
}
Array.from(args).forEach(arg => obj[typeof arg].push(arg))
return obj
}
let objectAssign = (tar, obj) => {
return (
Object.assign(
JSON.parse(JSON.stringify(tar)),
JSON.parse(JSON.stringify(obj))
)
)
}
let genClassList = (props, shortName) => {
let userClass = props.className
let rjx_class = `rjx-${shortName}-container`
return userClass
? `${userClass} ${rjx_class}`
: `${rjx_class}`
}
let addPreloader = _this => {
if(_this.props.preloader !== true) { return }
let root = _this.container.current
if(root) { root.classList.add('rjx-preloader') }
}
let remPreloader = _this => {
if(_this.props.preloader !== true) { return }
let root = _this.container.current
setTimeout(() => {
if(root) {
root.classList.add('rjx-preloader-end')
setTimeout(() => {
root.classList.remove('rjx-preloader')
root.classList.remove('rjx-preloader-end')
}, 300);
}
}, 10);
}
export {
argumentsMap,
objectAssign,
genClassList,
addPreloader,
remPreloader
}