If you want to listen your plugin state, you should add a cycle listener to plugin-spec.yml
file. And we will pass the state to you use the method
field explained in our common fields explanation.
In BEFORE_PLUGIN_LOAD
and AFTER_PLUGIN_LOADED
two request methods, we'll pass the plugin location path to you by putting into body
field, otherwise no other parameters.
Request example json:
{
"method": "AFTER_PLUGIN_LOADED",
"body": {
"path": "/path/plugin"
}
}
In this example, you should build an executable binary file or write an executable shell script, you can get an argument from commandline.
And you can refer our sample code in commandline demo plugin.
In this example, you need expose an endpoint /cycle-listener
in your web server, we'll use post method to request you.
And you can refer our sample code in http demo plugin.
In this example we create a listener file named cycle_listener.py
, and writing the following content:
In this example we create a listener file named cycle_listener.qlexpress
, and writing the following content:
At BEFORE_PLUGIN_LOAD
method request, you can return the plugin state to tell us whether to load your plugin, if you return the state is not RUNNING
, we do not load your plugin.
In actual development, you can do a lot of other things as needed.
Add the following content to plugin-spec.yml
:
cycle-listener: "{entry}"
cycle-listener: "{entry}/cycle-listener"
cycle-listener: ./cycle_listener.py
cycle-listener: ./cycle_listener.qlexpress