mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-07-02 21:52:48 +00:00
refactor(general): Clean up and add a logger (#587)
* feat(utils): Add logger * chore: Clean up some classes and add more logging * chore: Fix conflicts
This commit is contained in:
@@ -4,8 +4,10 @@ import { Platform } from '../utils/Utils.js';
|
||||
import sha1Hash from './polyfills/web-crypto.js';
|
||||
import package_json from '../../package.json' assert { type: 'json' };
|
||||
import evaluate from './jsruntime/jinter.js';
|
||||
import Log from '../utils/Log.js';
|
||||
|
||||
class Cache implements ICache {
|
||||
#TAG = 'Cache';
|
||||
#persistent_directory: string;
|
||||
#persistent: boolean;
|
||||
|
||||
@@ -21,7 +23,7 @@ class Cache implements ICache {
|
||||
#getBrowserDB() {
|
||||
const indexedDB: IDBFactory = Reflect.get(globalThis, 'indexedDB') || Reflect.get(globalThis, 'webkitIndexedDB') || Reflect.get(globalThis, 'mozIndexedDB') || Reflect.get(globalThis, 'msIndexedDB');
|
||||
|
||||
if (!indexedDB) return console.log('IndexedDB is not supported. No cache will be used.');
|
||||
if (!indexedDB) return Log.warn(this.#TAG, 'IndexedDB is not supported. No cache will be used.');
|
||||
|
||||
return new Promise<IDBDatabase>((resolve, reject) => {
|
||||
const request = indexedDB.open('youtubei.js', 1);
|
||||
|
||||
Reference in New Issue
Block a user