Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit 5fa4587

Browse files
committed
feat: seperate defaultConfig for supporting helper
1 parent 188368a commit 5fa4587

File tree

3 files changed

+49
-124
lines changed

3 files changed

+49
-124
lines changed

src/config/configMgr.js

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,56 +8,14 @@
88
'use strict';
99

1010
import _ from 'lodash';
11+
import defaultConfig from './defaultConfig';
1112

1213
/**
1314
* The container of current configs
1415
* @type {Object}
1516
*/
1617

1718
let currConfig = {};
18-
/**
19-
* Default settings for defaulter
20-
* @type {Object}
21-
*/
22-
23-
const defaultConfig = {
24-
model: {
25-
jsonPath: 'https://unpkg.com/live2d-widget-model-shizuku@latest/assets/shizuku.model.json',
26-
scale: 1,
27-
hHeadPos: 0.5,
28-
vHeadPos: 0.618,
29-
myDefine: [],
30-
},
31-
display: {
32-
superSample: 2,
33-
width: 150,
34-
height: 300,
35-
position: 'right',
36-
hOffset: 0,
37-
vOffset: -20,
38-
},
39-
mobile: {
40-
show: true,
41-
scale: 0.5,
42-
motion: true,
43-
},
44-
name: {
45-
canvas: 'live2dcanvas',
46-
div: 'live2d-widget',
47-
},
48-
react: {
49-
opacityDefault: 0.7,
50-
opacityOnHover: 0.2,
51-
myFunc: (e) => {console.log('(undefined) ┑( ̄Д  ̄)┍');},
52-
},
53-
dev: {
54-
log: false,
55-
border: (process.env.NODE_ENV === 'development' ? true : false),
56-
mouseLog: false,
57-
mouseFunc: (x, y, ix, iy) => {console.log(`MouseFunc: ${x},${y}; ${ix}, ${iy}`);},
58-
},
59-
// _: true,
60-
}
6119

6220
/**
6321
* Apply users function, make the full settings
@@ -67,14 +25,6 @@ const defaultConfig = {
6725

6826
function configApplyer(userConfig){
6927

70-
// if (_.has(userConfig, '_')){
71-
// import(/* webpackMode: "lazy" */ './configValidater').then(f => {
72-
// f.configValidater(userConfig);
73-
// }).catch(err => {
74-
// console.error(err);
75-
// });
76-
// }
77-
7828
currConfig = _.defaultsDeep(userConfig, defaultConfig);
7929
// console.log('Live2Dwidget: currConfig', currConfig);
8030

src/config/configValidater.js

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/config/defaultConfig.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* @description The storage of configs. Intend to unify serverJs and clientJs's config
3+
*/
4+
5+
/**
6+
* Default settings for defaulter
7+
* @type {Object}
8+
*/
9+
10+
const defaultConfig = {
11+
model: {
12+
jsonPath: 'https://unpkg.com/live2d-widget-model-shizuku@latest/assets/shizuku.model.json',
13+
scale: 1,
14+
hHeadPos: 0.5,
15+
vHeadPos: 0.618,
16+
myDefine: [],
17+
},
18+
display: {
19+
superSample: 2,
20+
width: 150,
21+
height: 300,
22+
position: 'right',
23+
hOffset: 0,
24+
vOffset: -20,
25+
},
26+
mobile: {
27+
show: true,
28+
scale: 0.5,
29+
motion: true,
30+
},
31+
name: {
32+
canvas: 'live2dcanvas',
33+
div: 'live2d-widget',
34+
},
35+
react: {
36+
opacityDefault: 0.7,
37+
opacityOnHover: 0.2,
38+
myFunc: (e) => {console.log('(undefined) ┑( ̄Д  ̄)┍');},
39+
},
40+
dev: {
41+
log: false,
42+
border: (process.env.NODE_ENV === 'development' ? true : false),
43+
mouseLog: false,
44+
mouseFunc: (x, y, ix, iy) => {console.log(`MouseFunc: ${x},${y}; ${ix}, ${iy}`);},
45+
},
46+
}
47+
48+
module.exports = defaultConfig;

0 commit comments

Comments
 (0)