Skip to content

Commit

Permalink
fix: common.base64
Browse files Browse the repository at this point in the history
  • Loading branch information
sj817 committed May 8, 2024
1 parent 90e7fc2 commit ea5cde2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Common {

/** base64:// */
if (file.startsWith('base64://')) {
return file
return file.replace('base64://', '')
}

/** url */
Expand Down
7 changes: 3 additions & 4 deletions lib/utils/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ class EventHandler {
* @param {string} [config.key] 事件键 未传入则删除所有处理器
*/
del ({ dir, name, key = '' }) {
/** 这里是删除所有 全部重新初始化 */
if (!key && !dir && !name) {
Object.keys(this.events).forEach((k) => this.del({ dir, name, key: k }))
this.events = {}
return true
}

// 删除指定目录下的所有处理器
/** 热重载 删除指定目录 */
if (!key) {
// 循环所有键
for (let v of Object.keys(this.events)) {
// 循环键的每个处理器,删除指定目录下的处理器
this.events[v] = this.events[v].filter(v => v.file.dir !== dir || v.file.name !== name)
// 如果处理器为空则删除键
if (!this.events[v].length) {
Expand Down

0 comments on commit ea5cde2

Please sign in to comment.