The Source for Java Technology Collaboration
User: Password:



Greg Murray

Greg Murray's Blog

jMaki Extensions

Posted by gmurray71 on June 07, 2007 at 03:37 PM | Comments (3)

Just when we thought it was safe to call jMaki feature complete we got a lot of feedback for various features that could all be handled by a single extension feature.

What are extensions in jMaki?

Extensions are behavior / functionality that are shared across widgets. Extensions are loaded after the jmaki.js and before glue (your application logic). Examples may include enhanced debugging support, sound, or controllers that are specific to an individual application.

What does an extension look like?

jmaki.namespace("jmaki.extensions.jmaki.ext.bar");

jmaki.extensions.jmaki.ext.bar.Extension = function(args) {
  jmaki.debug = true;
  jmaki.log("jMaki bar Extension intialized");
  jmaki.log("jMaki bar : extensionDir=" + args.extensionDir);
 }

Extensions are namespaced JavaScript objects that are mapped in the config.json file like the following:

{
  'config': {
    'version': '.9.3',
    'extensions' : [
          'jmaki.ext.foo' 
         ]
    }    
}

Extensions are like widgets in that the application will look under /resources/jmaki/ext/bar for a file called extension.js. The contents are like the file above. The extensions will be located in the resources directory and located using the extension name. The extension 'jmaki.ext.foo' would be located in the following directory:

resources
    |
    +jmaki
       |
       +ext
          |
          +foo
             |
             +extension.js

Extensions can also be loaded on a per URL basis or based on a wildcard like you may see in the code below:

{
  'config': {
    'version': '.9.3',
    'extensions' : [
          { url : '/basicArgs.jsp',  name : 'jmaki.ext.foo' },
          { url : '*.jsp', name : 'jmaki.ext.bar'},
          { url : '/relativedir/*', name : 'jmaki.ext.foo', args : { 'topic' : 'footopic'}}
         ]
    }    
}

Notice the url property can be a URL or contain a '*'. The mappings can also provide an args property containing default data that is accessible in the extension (extension.js).

We also plan on adding a page level tag and or function for adding functions in the next release. It is our hope to keep the core of jMaki small and nimble. At the same time we want to future proof jMaki.Extensions are available in the PHP, Phobos, and Java versions of jMaki and may be found at the jMaki Downloads page.

Here are some extensions we are thinking about:

  • Back/Forward button tracking
  • Sound
  • Bookmarking
  • Google Gears Integration
  • Cross Widget Drag and Drop
  • JavaScript controllers

What kind of extensions would you like to see for jMaki?


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Hey Greg...

    How are thinking of doing sound?

    Also, I'll send you some info from our book on the back button stuff we've worked on.

    Ciao.

    Posted by: andrecharland on June 08, 2007 at 04:38 PM

  • there are a few javascript libs that wrap a flash movie where all it does is play a sound. http://www.flashsoundapi.com/ is one.

    Posted by: ilazarte on June 11, 2007 at 09:07 AM

  • Hi,

    We are going to use http://www.schillmania.com/projects/soundmanager2/ as it works well and we have a widget for it already. The widget will register a publish / subscribe topic and play a sound when a message is published (generally from your application glue). Part of the motivation for creating extensions was that we could have a better contract for shared behavior that all widgets could potentially use.

    A movie widget would be nice too.

    The nice thing about jMaki is it allows you to wrap pretty much anything and have it interact with your applications using JavaScript.

    Posted by: gmurray71 on June 11, 2007 at 10:25 AM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds