refactor: change common -> index

(cherry picked from commit eb6be0d9d13a0834b6a7ada9aab846cfbbdfd664)
This commit is contained in:
MengYX 2022-01-09 10:22:00 +08:00
parent 976077e3e1
commit 8260e744ca
No known key found for this signature in database
GPG Key ID: E63F9C7303E8F604
3 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@
<script> <script>
import { spawn, Worker, Pool } from 'threads'; import { spawn, Worker, Pool } from 'threads';
import { CommonDecrypt } from '@/decrypt/common.ts'; import { Decrypt } from '@/decrypt';
import { DecryptQueue } from '@/utils/utils'; import { DecryptQueue } from '@/utils/utils';
import { storage } from '@/utils/storage'; import { storage } from '@/utils/storage';
@ -74,7 +74,7 @@ export default {
}, },
async addFile(file) { async addFile(file) {
this.task_all++; this.task_all++;
this.queue.queue(async (dec = CommonDecrypt) => { this.queue.queue(async (dec = Decrypt) => {
console.log('start handling', file.name); console.log('start handling', file.name);
try { try {
this.$emit('success', await dec(file, await storage.getAll())); this.$emit('success', await dec(file, await storage.getAll()));

View File

@ -13,7 +13,7 @@ import { SplitFilename } from '@/decrypt/utils';
import { storage } from '@/utils/storage'; import { storage } from '@/utils/storage';
import InMemoryStorage from '@/utils/storage/InMemoryStorage'; import InMemoryStorage from '@/utils/storage/InMemoryStorage';
export async function CommonDecrypt(file: FileInfo, config: Record<string, any>): Promise<DecryptResult> { export async function Decrypt(file: FileInfo, config: Record<string, any>): Promise<DecryptResult> {
// Worker thread will fallback to in-memory storage. // Worker thread will fallback to in-memory storage.
if (storage instanceof InMemoryStorage) { if (storage instanceof InMemoryStorage) {
await storage.setAll(config); await storage.setAll(config);

View File

@ -1,4 +1,4 @@
import { expose } from 'threads/worker'; import { expose } from 'threads/worker';
import { CommonDecrypt } from '@/decrypt/common'; import { Decrypt } from '@/decrypt';
expose(CommonDecrypt); expose(Decrypt);