MITHgrid

JavaScript framework for building data-oriented, event-driven browser applications.

plugin.coffee

src/

Plugins

MITHgrid.namespace "Plugin", (exports) ->

This is the base of a plugin, which can package together various things that augment an application.

MITHgrid.Plugin.MyPlugin.initInstance = function(options) { var that = MITHgrid.Plugin.initInstance('MyPlugin', options, { ... }) };

var myApp = MITHgrid.Application({ plugins: [ { name: 'MyPlugin', ... } ] });

  
  exports.initInstance = (klass, options) ->
    that = { options: options, presentation: { } }
    readyFns = [ ]
  
    that.getTypes = () ->
      if options?.types?
        options.types
      else
        [ ]
  
    that.getProperties = () ->
      if options?.properties?
        options.properties
      else
        [ ]
        
    that.getComponents = () ->
      if options?.components?
        options.components
      else
        [ ]
  
    that.getPresentations = () ->
      if options?.presentations?
        options.presentations
      else
        [ ]
  
    that.ready = readyFns.push
  
    that.eventReady = (app) ->
      for fn in readyFns
        fn app
      readyFns = []
      that.ready = (fn) ->
        fn app
  
    that

generated Wed May 01 2013 09:27:59 GMT-0400 (EDT)

This project is maintained by umd-mith

Hosted on GitHub Pages — Theme by orderedlist