0,0 → 1,31 |
|
println("Language extensions samples"); |
|
println("|> Inclusion of langext-included.js, composition of "); |
println("|> an object from different files"); |
|
function method1_implementation() { |
println("This method is defined in langext.js"); |
} |
|
var method2_implementation = null; |
|
// If method2 was defined this way it will fail, it needs to be |
// defined as with method3 |
var obj = { |
method1: method1_implementation, |
method2: method2_implementation, |
method3: function() { |
method3_implementation(); |
} |
}; |
|
lang.include("langext-included.js"); |
|
// ... instead, it can be defined now though |
obj.method2 = method2_implementation; |
|
println("|> calling of methods defined elsewhere:"); |
obj.method1(); |
obj.method2(); |
obj.method3(); |