MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / onInstall

Function onInstall

src/pages/plugins/plugins.js:729–757  ·  view source on GitHub ↗
(plugin)

Source from the content-addressed store, hash-verified

727 }
728
729 function onInstall(plugin) {
730 if (updates) return;
731
732 if (!plugin || !plugin.id) {
733 console.error("Invalid plugin object passed to onInstall");
734 return;
735 }
736 plugin.installed = true;
737
738 const existingIndex = plugins.installed.findIndex(
739 (p) => p.id === plugin.id,
740 );
741 if (existingIndex === -1) {
742 plugins.installed.push(plugin);
743 } else {
744 // Update existing plugin
745 plugins.installed[existingIndex] = plugin;
746 }
747
748 const allPluginIndex = plugins.all.findIndex((p) => p.id === plugin.id);
749 if (allPluginIndex !== -1) {
750 plugins.all[allPluginIndex] = plugin;
751 }
752
753 const existingItem = $list.installed.get(`[data-id="${plugin.id}"]`);
754 if (!existingItem) {
755 $list.installed.append(<Item {...plugin} updates={updates} />);
756 }
757 }
758
759 function onUninstall(pluginId) {
760 if (!updates) {

Callers 1

installFunction · 0.85

Calls 3

appendMethod · 0.80
errorMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected