mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-17 11:30:28 +01:00
Add tests to repository
This commit is contained in:
27
tests/javascript/namespaces.js
Normal file
27
tests/javascript/namespaces.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/* Object Literal Notation */
|
||||
var objectLiteral = {
|
||||
str: '1',
|
||||
func: function() { return 1; }
|
||||
};
|
||||
|
||||
/* Module Pattern 1 */
|
||||
var module = (function(){
|
||||
var private = 1;
|
||||
return {
|
||||
method: function() { private++; }
|
||||
};
|
||||
})();
|
||||
|
||||
/* Module Pattern 2 */
|
||||
var module2 = {};
|
||||
(function(context){
|
||||
var private = 1;
|
||||
context.method = function() { private++; }
|
||||
})(module2);
|
||||
|
||||
/* Module Pattern 3 */
|
||||
var module3 = {};
|
||||
(function(){
|
||||
var private = 1;
|
||||
this.method = function() { private++; }
|
||||
}).apply(module3);
|
||||
Reference in New Issue
Block a user