Skip to content
jefferscn edited this page Sep 24, 2014 · 2 revisions

What is plugin

plugin is a set of logics,views,data and dependencies.plugin provide a group of functions seperated. so a website can be build up with plugins already existed and plugin can be reusable. some plugins are private and difficult to reuse, but there are always a lot of plugins could be for public. plugin privode an ability to share a set of function in a website development.

How it work

this project is based on Express. the main workflow is the same with it. plugin should be put to a specified directory,every sub directory of it is looked as a plugin. initialize of the plugin will to something like routing of Express. plugin can register a set of widgets and pages. in the route of plugin,u can use 'xxxxxx.viewname' to use a view of plugin.

Architecture

in a plugin,there must be an init.js file,this file will be executed in the process of initialize of the plugin framework.there could be a directory named "views",just like the views directiory of Express.

init.js

  • function init

    this function will be executed when initializing this plugin. u can do something like data initialize, and other operate to application.

  • dependencies

    this property is an array.every item in it is a plugin name.the dependency plugin will be initialize before this plugin.

  • widgets

    this property is an array.like

     [{
      name:'logout',
      route:user.logout
     }]
  • pages

    this property is an array.

Clone this wiki locally