Helma Logo
main list history

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

1Normally all variables and methods in Helma-NG modules are "public", but there is a way to create private ones:
3 (function(scope) {
4    
5    var privateMethod = function() {
6      writeln("I'm private");
7      return;
8    };
9      
10    scope.publicMethod = function() {
11      privateMethod();
12      writeln("I'm public");
13      return;
14    };
15    
16 })(global);
17
18Instead 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.