Skip to content

old.Plugin Example

marc2332 edited this page Feb 16, 2020 · 1 revision

This is a short explanation of how to make a simple plugin.

Working example: https://github.com/Graviton-Code-Editor/Plugin-Example

Prerequisites:

  • Graviton v1.1.0+

First, create your plugin's folder in the .graviton/plugins directory. It might look like:

Note: The plugin folder should be called as the plugin.

/.graviton  
β”‚
└───/plugins
|   |
|   └───/myPlugin
|   
└───/plugins_db
|   config.json
|   log.json
|   market.json

Now, move inside your plugin and create two files, like:

/myPlugin
|   
|   package.json
|   main.js

Inside package.json paste this:

{
   "name":"myPlugin",
   "version":"0.0.1",
   "author":"An hero",
   "description":"A super plugin!",
   "main":"main.js",
   "css":[]
}   

And, inside main.js, paste this:

const myPluginDropMenu = new dropMenu({
  id:"my_plugin_dm"
});
myPluginDropMenu.setList({
  "button": "My Plugin!",
  "list":{
    "Click me!":{
      click:function(){
        new Notification('Whoah!!','A notification!');
      }
    }
  }
})

Now, reload Graviton and see what's on the top menu bar! πŸš€

Clone this wiki locally