加载进度事件

This commit is contained in:
unanmed 2023-06-17 17:25:55 +08:00
parent 754edac71a
commit 6eacff68d3
4 changed files with 45 additions and 34 deletions

View File

@ -22,7 +22,7 @@
"jszip": "^3.10.1",
"lodash-es": "^4.17.21",
"lz-string": "^1.5.0",
"mutate-animate": "^1.1.1",
"mutate-animate": "^1.1.3",
"three": "^0.149.0",
"vue": "^3.3.4"
},

View File

@ -1,4 +1,4 @@
lockfileVersion: '6.1'
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
@ -27,8 +27,8 @@ dependencies:
specifier: ^1.5.0
version: 1.5.0
mutate-animate:
specifier: ^1.1.1
version: 1.1.1
specifier: ^1.1.3
version: 1.1.3
three:
specifier: ^0.149.0
version: 0.149.0
@ -256,7 +256,7 @@ packages:
'@babel/compat-data': 7.22.5
'@babel/core': 7.22.5
'@babel/helper-validator-option': 7.22.5
browserslist: 4.21.8
browserslist: 4.21.9
lru-cache: 5.1.1
semver: 6.3.0
dev: true
@ -1740,7 +1740,7 @@ packages:
resolution: {integrity: sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==}
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
dependencies:
semver: 7.5.1
semver: 7.5.2
dev: true
/@pkgjs/parseargs@0.11.0:
@ -1983,7 +1983,7 @@ packages:
dependencies:
'@babel/core': 7.22.5
'@babel/preset-env': 7.22.5(@babel/core@7.22.5)
browserslist: 4.21.8
browserslist: 4.21.9
core-js: 3.31.0
magic-string: 0.30.0
regenerator-runtime: 0.13.11
@ -2174,8 +2174,8 @@ packages:
engines: {node: '>=0.4.0'}
dev: true
/acorn@8.8.2:
resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==}
/acorn@8.9.0:
resolution: {integrity: sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ==}
engines: {node: '>=0.4.0'}
hasBin: true
dev: true
@ -2402,15 +2402,15 @@ packages:
fill-range: 7.0.1
dev: true
/browserslist@4.21.8:
resolution: {integrity: sha512-j+7xYe+v+q2Id9qbBeCI8WX5NmZSRe8es1+0xntD/+gaWXznP8tFEkv5IgSaHf5dS1YwVMbX/4W6m937mj+wQw==}
/browserslist@4.21.9:
resolution: {integrity: sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==}
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
dependencies:
caniuse-lite: 1.0.30001502
electron-to-chromium: 1.4.430
caniuse-lite: 1.0.30001503
electron-to-chromium: 1.4.432
node-releases: 2.0.12
update-browserslist-db: 1.0.11(browserslist@4.21.8)
update-browserslist-db: 1.0.11(browserslist@4.21.9)
dev: true
/buffer-alloc-unsafe@1.1.0:
@ -2503,8 +2503,8 @@ packages:
engines: {node: '>=10'}
dev: true
/caniuse-lite@1.0.30001502:
resolution: {integrity: sha512-AZ+9tFXw1sS0o0jcpJQIXvFTOB/xGiQ4OQ2t98QX3NDn2EZTSRBC801gxrsGgViuq2ak/NLkNgSNEPtCr5lfKg==}
/caniuse-lite@1.0.30001503:
resolution: {integrity: sha512-Sf9NiF+wZxPfzv8Z3iS0rXM1Do+iOy2Lxvib38glFX+08TCYYYGR5fRJXk4d77C4AYwhUjgYgMsMudbh2TqCKw==}
dev: true
/chalk@2.4.2:
@ -2684,7 +2684,7 @@ packages:
/core-js-compat@3.31.0:
resolution: {integrity: sha512-hM7YCu1cU6Opx7MXNu0NuumM0ezNeAeRKadixyiQELWY3vT3De9S4J5ZBMraWV2vZnrE1Cirl0GtFtDtMUXzPw==}
dependencies:
browserslist: 4.21.8
browserslist: 4.21.9
dev: true
/core-js@3.31.0:
@ -2816,8 +2816,8 @@ packages:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
dev: true
/electron-to-chromium@1.4.430:
resolution: {integrity: sha512-FytjTbGwz///F+ToZ5XSeXbbSaXalsVRXsz2mHityI5gfxft7ieW3HqFLkU5V1aIrY42aflICqbmFoDxW10etg==}
/electron-to-chromium@1.4.432:
resolution: {integrity: sha512-yz3U/khQgAFT2HURJA3/F4fKIyO2r5eK09BQzBZFd6BvBSSaRuzKc2ZNBHtJcO75/EKiRYbVYJZ2RB0P4BuD2g==}
dev: true
/emoji-regex@8.0.0:
@ -3896,8 +3896,8 @@ packages:
resolution: {integrity: sha512-YVE1mIJ4VpUMqZObFndk9CJu6DBJR/GB13p3tXuNbwD4XExaI5EOuRl6BHeIDxIqXZVxSfAC+y6U1Z/IxCfKUg==}
dev: true
/mutate-animate@1.1.1:
resolution: {integrity: sha512-6IPEeM4qLsoMx0T3iKSNCPEva2R6F7bR8P/C1+DlIQGkuWLf2ttF9NJpUITBfeL134xoazUERSgznyBghapIYw==}
/mutate-animate@1.1.3:
resolution: {integrity: sha512-AmxQ18jZVeozw/lT3PkU6KX9a/iNxDXl4ENcE4ZM8lV+H1vL21KXI6qsiIgBduJJbmSRGdOpbqdgsyJLmM+F4w==}
dev: false
/nan@2.17.0:
@ -3945,7 +3945,7 @@ packages:
nopt: 6.0.0
npmlog: 6.0.2
rimraf: 3.0.2
semver: 7.5.1
semver: 7.5.2
tar: 6.1.15
which: 2.0.2
transitivePeerDependencies:
@ -3970,7 +3970,7 @@ packages:
dependencies:
hosted-git-info: 4.1.0
is-core-module: 2.12.1
semver: 7.5.1
semver: 7.5.2
validate-npm-package-license: 3.0.4
dev: true
@ -4399,8 +4399,8 @@ packages:
hasBin: true
dev: true
/semver@7.5.1:
resolution: {integrity: sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==}
/semver@7.5.2:
resolution: {integrity: sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ==}
engines: {node: '>=10'}
hasBin: true
dependencies:
@ -4645,7 +4645,7 @@ packages:
hasBin: true
dependencies:
'@jridgewell/source-map': 0.3.3
acorn: 8.8.2
acorn: 8.9.0
commander: 2.20.3
source-map-support: 0.5.21
dev: true
@ -4733,7 +4733,7 @@ packages:
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 18.16.18
acorn: 8.8.2
acorn: 8.9.0
acorn-walk: 8.2.0
arg: 4.1.3
create-require: 1.1.1
@ -4860,19 +4860,19 @@ packages:
/unplugin@1.3.1:
resolution: {integrity: sha512-h4uUTIvFBQRxUKS2Wjys6ivoeofGhxzTe2sRWlooyjHXVttcVfV/JiavNd3d4+jty0SVV0dxGw9AkY9MwiaCEw==}
dependencies:
acorn: 8.8.2
acorn: 8.9.0
chokidar: 3.5.3
webpack-sources: 3.2.3
webpack-virtual-modules: 0.5.0
dev: true
/update-browserslist-db@1.0.11(browserslist@4.21.8):
/update-browserslist-db@1.0.11(browserslist@4.21.9):
resolution: {integrity: sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==}
hasBin: true
peerDependencies:
browserslist: '>= 4.21.0'
dependencies:
browserslist: 4.21.8
browserslist: 4.21.9
escalade: 3.1.1
picocolors: 1.0.0
dev: true
@ -5008,7 +5008,7 @@ packages:
dependencies:
'@volar/vue-language-core': 1.6.5
'@volar/vue-typescript': 1.6.5(typescript@5.1.3)
semver: 7.5.1
semver: 7.5.2
typescript: 5.1.3
dev: true

View File

@ -25,8 +25,8 @@ export class SoundEffect extends AudioPlayer {
}
set stereo(value: boolean) {
if (value !== this._stereo) this.initAudio(value);
this._stereo = value;
this.initAudio(value);
}
get stereo(): boolean {
return this._stereo;
@ -55,6 +55,7 @@ export class SoundEffect extends AudioPlayer {
* source -> gain -> destination
* source -> panner -> gain --> destination
* source -> merger -> panner -> gain -> destination
*
* ```
* @param stereo
*/

View File

@ -147,7 +147,12 @@ export class Resource<
) {
this.emit('loadstart');
this.request = axios
.get(data, { responseType: this.format })
.get(data, {
responseType: this.format,
onDownloadProgress: e => {
this.emit('progress', e);
}
})
.then(v => {
this.resource = v.data;
this.loaded = true;
@ -157,7 +162,12 @@ export class Resource<
} else if (this.format === 'zip') {
this.emit('loadstart');
this.request = axios
.get(data, { responseType: 'arraybuffer' })
.get(data, {
responseType: 'arraybuffer',
onDownloadProgress: e => {
this.emit('progress', e);
}
})
.then(v => {
this.resource = new ZippedResource(v.data);
this.loaded = true;