Helma Logo
main list history
previous version  overview  next version

Version 1 by robert on 08. May 2008, 10:46

Normally all variables and methods in Helma-NG modules are "public", but there is a way to create private ones:

(function(scope) {
    
    var privateMethod = function() {
      writeln("I'm private");
      return;
    };
      
    scope.publicMethod = function() {
      privateMethod();
      writeln("I'm public");
      return;
    };
    
})(global);

Instead of passing the global object as argument, one can also use "this" inside the method to reference the module's scope (so "scope.publicMethod" becomes "this.publicMethod"), however imho it's quite confusing.

     removed
     added