Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
add Load Extension (#44)
Browse files Browse the repository at this point in the history
* add Load Extension events to consts

sessionEventLoadedExtension and sessionCmdLoadExtension

* add Load Extension switch case

Do we need to do something different on L171?

* add json.path to loadExtension() + tidy
  • Loading branch information
wickedst committed May 2, 2021
1 parent cf8ac47 commit 0f136df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ function onReady () {
elements[json.targetID].flushStorageData();
client.write(json.targetID, consts.eventNames.sessionEventFlushedStorage)
break;

case consts.eventNames.sessionCmdLoadExtension:
elements[json.targetID].loadExtension(json.path).then(() => {
client.write(json.targetID, consts.eventNames.sessionEventLoadedExtension)
})
break;

// Sub menu
case consts.eventNames.subMenuCmdAppend:
elements[json.targetID].append(menuItemCreate(json.menuItem))
Expand Down
2 changes: 2 additions & 0 deletions src/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ module.exports = {
notificationEventShown: "notification.event.shown",
sessionCmdClearCache: "session.cmd.clear.cache",
sessionCmdFlushStorage: "session.cmd.flush.storage",
sessionCmdLoadExtension: "session.cmd.load.extension",
sessionEventClearedCache: "session.event.cleared.cache",
sessionEventWillDownload: "session.event.will.download",
sessionEventFlushedStorage: "session.event.flushed.storage",
sessionEventLoadedExtension: "session.event.loaded.extension",
subMenuCmdAppend: "sub.menu.cmd.append",
subMenuCmdClosePopup: "sub.menu.cmd.close.popup",
subMenuCmdInsert: "sub.menu.cmd.insert",
Expand Down

0 comments on commit 0f136df

Please sign in to comment.