Raindrop/FrontEnd: Difference between revisions

(Created page with 'Raindrop == General Architecture == For a quick summary of Raindrop's complete architecture, see Raindrop Software Architecture. The Fro…')
 
Line 144: Line 144:


<pre>
<pre>
//Tell the loader the name of this module
//Tell the loader that rdw/Message will be modified,
dojo.provide("ext.sample");
//and give the name of this extension. Also indicate
//the dependencies for the extension.


//Indicate the module dependencies for this extension.
run.modify("rdw/Message", "ext/sample",
//Since this extension will extend rdw.Message it should list
["rd", "rdw/Message"], function (rd, Message) {
//rdw.Message as a dependency.
dojo.require("rdw.Message");


//Tell raindrop you want to apply an extension, and what will be extended.
    //Tell raindrop you want to apply an extension, and what will be extended.
rd.applyExtension("ext.sample", "rdw.Message", {
    rd.applyExtension("ext/sample", "rdw/Message", {


  //Register "before" extension points. These extension functions should be called before
        //Register "before" extension points.
  //the matching function on rdw.Message
        //These extension functions should be called before
  before: {
        //the matching function on rdw/Message
    //This postCreate will be called before an instance of
        before: {
    //rdw.Message's postCreate method is called.
            //This postCreate will be called before an instance of
    postCreate: function() {
            //rdw/Message's postCreate method is called.
    }
            postCreate: function() {
  },
            }
        },


  //Register "after" extension points. These extension functions should be called before
        //Register "after" extension points.
  //the matching function on rdw.Message
        //These extension functions should be called before
  after: {
        //the matching function on rdw/Message
    //This postCreate will be called after an instance of
        after: {
    //rdw.Message's postCreate method is called.
            //This postCreate will be called after an instance of
    postCreate: function() {
            //rdw/Message's postCreate method is called.
    }
            postCreate: function() {
  },
            }
 
        },
  //Register "around" extension points. These extension functions should be called before
       
  //the matching function on rdw.Message, and this extension point has the option to
        //Register "around" extension points.
  //to call the original rdw.Message function or bypass it completely. It also has the ability
        //These extension functions should be called before
  //to modify the return value from the rdw.Message function call.
        //the matching function on rdw/Message, and this extension  
  //This type of extension point is very experimental and may change due to its use
        //point has the option to to call the original rdw/Message  
  //of arguments.callee
        //function or bypass it completely. It also has the ability
  around: {
        //to modify the return value from the rdw/Message function call.
    //This postCreate will be called before an instance of
        //This type of extension point is very experimental and may  
    //rdw.Message's postCreate method is called. If it wants to
        //change due to its use of arguments.callee
    //call rdw.Message's postCreate function, it can  
        around: {
    postCreate: function() {
            //This postCreate will be called before an instance of
      //Demonstrates calling the rdw.Message function that this extension
            //rdw/Message's postCreate method is called. If it wants to
      //point is wrapping around.
            //call rdw/Message's postCreate function, it can  
      var value = arguments.callee.target.apply(this, arguments);
            postCreate: function() {
      //Modify value then return it.
                //Demonstrates calling the rdw/Message function  
    }
                //that this extension point is wrapping around.
 
                var value = arguments.callee.target.apply(this, arguments);
  },
                //Modify value then return it.
 
            }
  //Register "replace" extension points. These extension functions replace the
       
  //the matching function on rdw.Message. It will first check rdw.Message for  
        },
  //the matching function, then look at rdw.Message.prototype for the method.
   
  replace: {
        //Register "replace" extension points.
    //This postCreate will be replace rdw.Message.prototype.postCreate
        //These extension functions replace the the matching function
    postCreate: function() {
        //on rdw/Message. It will first check rdw/Message for  
    }
        //the matching function, then look at rdw/Message's prototype
  },
        //for the method.
 
        replace: {
  //Register "add" extension points. These extension functions will be
            //This postCreate will be replace rdw/Message's
  //added to rdw.Message. Note that they are added to rdw.Message, and *not*
            //prototype.postCreate
  //rdw.Message.prototype, so they will not be callable from instances of rdw.Message.
            postCreate: function() {
  add: {
            }
    //This function will be placed on rdw.Message, it is like adding a "class-level"
        },
    //function vs an instance-level function.
   
    getInstances: function() {
        //Register "add" extension points.
    }
        //These extension functions will be added to rdw/Message.
  },
        //Note that they are added to rdw/Message, and *not*
 
        //rdw/Message's prototype, so they will not be callable
  //Register "addToPrototype" extension points. These extension functions will be
        //from instances of rdw/Message.
  //added to rdw.Message.prototype, and *not* to rdw.Message.
        add: {
  addToPrototype: {
            //This function will be placed on rdw/Message,
    //This function will be placed on rdw.Message.prototype, it is like adding an
            //it is like adding a "class-level"
    //instance-level function vs a "class-level" function.
            //function vs an instance-level function.
    onActionClick: function() {
            getInstances: function() {
    }
            }
  }
        },
   
        //Register "addToPrototype" extension points.
        //These extension functions will be
        //added to rdw/Message's prototype, and *not* to rdw/Message.
        addToPrototype: {
            //This function will be placed on  
            //rdw/Message's prototype, it is like adding an
            //instance-level function vs a "class-level" function.
            onActionClick: function() {
            }
        }
    });
});
});


109

edits