Commit da0df0f
埃博拉酱
fix: call unmountPlugin before reloading plugin script
When loadPlugin.js reloads a plugin, Acode loads the new script directly.
The new script's init() then calls acode.setPluginUnmount(id, newDestroy),
which is a simple assignment that replaces the old destroy callback.
At that point the old destroy which holds references to the old sidebar
app, commands, event listeners, etc. is lost forever.
Fix: call acode.unmountPlugin(pluginId) before loading the new script,
so the old destroy() runs while it still exists. Also remove the old
<script> tag so the browser fetches the new source.1 parent 59df8a0 commit da0df0f
1 file changed
+21
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
11 | 32 | | |
12 | 33 | | |
13 | 34 | | |
| |||
0 commit comments