Skip to content

Commit 10b31eb

Browse files
committed
Edit: works with react
1 parent 0558079 commit 10b31eb

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "spacha",
33
"version": "1.0.4",
44
"description": "",
5-
"main": "dist/spacha.node.js",
6-
"types": "dist/src/index.node.d.ts",
5+
"main": "dist/spacha.js",
6+
"types": "dist/src/index.d.ts",
77
"scripts": {
88
"prebuild": "rimraf dist",
99
"build": "npx webpack --config webpack.config.js",

src/SpachaCore.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,27 @@ export class SpachaCore {
99
}
1010

1111
private init = () => {
12+
const options = { ...this.options };
1213
const themeArray = Object.keys(themes).map((key) => ({
1314
...themes[key],
1415
name: key,
1516
}));
1617
const randomTheme =
1718
themeArray[Math.floor(Math.random() * themeArray.length)];
18-
this.options.price ??= randomTheme.price;
19-
this.options.scale ??= 1.0;
20-
this.scale = this.options.scale;
21-
//this.options.theme ??= randomTheme.name;
22-
this.options.themeOption ??= this.options.theme
23-
? themes[this.options.theme ?? randomTheme.name]
24-
: this.themeFromPrice(this.options.price);
25-
this.options.user ??= {
19+
options.price ??= randomTheme.price;
20+
options.scale ??= 1.0;
21+
this.scale = options.scale;
22+
//options.theme ??= randomTheme.name;
23+
options.themeOption ??= options.theme
24+
? themes[options.theme ?? randomTheme.name]
25+
: this.themeFromPrice(options.price);
26+
options.user ??= {
2627
name: 'YouTube User',
2728
};
28-
this.options.user.name ??= 'YouTube User';
29-
this.options.shaddow ??= true;
29+
options.user.name ??= 'YouTube User';
30+
options.shaddow ??= true;
31+
32+
this.options = options;
3033
};
3134

3235
protected themeFromPrice = (price: number): Theme => {

tsconfig.json

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
{
22
"compilerOptions": {
3-
"target": "ESNext",
3+
"target": "ES5",
44
"module": "CommonJS",
55
"moduleResolution": "Node",
66
"esModuleInterop": true,
77
"strict": true,
8-
"lib": ["es2018", "DOM"],
9-
"types": ["node", "jest"],
8+
"lib": [
9+
"es2018",
10+
"DOM"
11+
],
12+
"types": [
13+
"node",
14+
"jest"
15+
],
1016
"declaration": true,
1117
"sourceMap": true,
1218
"outDir": "dist"
1319
},
14-
"include": ["src", "tests"]
20+
"include": [
21+
"src",
22+
"tests"
23+
]
1524
}

0 commit comments

Comments
 (0)