Main

new Main()

Main plugin class. This is the special plugin created by Bajo during the boot process, solely made for you to write your own code for your application. It behaves like any other plugin, with a few differences:

  • It always there, can't be disabled nor removed, reside in the app's root directory named main. If it's folder is missing, Bajo will create it during the boot process with the default template and settings.
  • You don't have to put this plugin in your .plugin file or package.json file, it is always present and always loaded as the last plugin to load.
  • You write your app the same way you would do it with plugin:
    • by creating properties & methods within your class
    • by extending other plugins inside /main/extend/{pluginNs} folder
    • by tapping hooks inside /main/extend/bajo/hook folder or /main/extend/bajo/hook.js file
    • you even have your own config file in {dataDir}/config/main.{ext}

Why it has to be a plugin? Because Bajo is a plugin-based framework, and everything is a plugin. This brings some flexibilities, e.g. when someday you think your main plugin become too big, just turn it into a separate plugin and move it to its own package with almost no code changes at all.

For more on this, see Plugin and module:Hook