Skip to content

Event Plugin

Niklaus Schen edited this page Nov 16, 2023 · 2 revisions

In Meproc, users can develop plugins to handle the start and stop events of certain task processes based on their needs.

All plugins should be put in events folder.

Let's take a look at an example.

There is a file named example.m in events folder. It is the example that we are going to talk about.

Sys = Import('sys');

Example {
    @start(&proc) {
        Sys.print(proc);
    }
    @stop(&proc) {
        Sys.print(proc);
    }
}

This example outputs task-related array information when a task named example is started or stopped.

The set name (refer to Melang Set) Example is the capitalized task name.

In general, the set should implement both start and stop methods. However, if the developer is not concerned about the start or stop event, they can also omit the corresponding method.

In this file, developers can include the code they need and import the corresponding libraries to develop their desired processing logic. Therefore, apart from the mentioned set name (e.g. Example) and the two methods (start and stop), there are no additional restrictions.

That's all.

Clone this wiki locally