forked from samejack/blog-content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUniversal-plus.js
43 lines (37 loc) · 853 Bytes
/
Universal-plus.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'use strict';
/**
* Universal JavaScript package PLUS!
* JavaScript, NodeJS Module and RequireJS Module Supported
*/
(function (name, definition) {
if (typeof(module) !== 'undefined' && module.exports) {
module.exports = definition;
} else if (typeof(define) === 'function') {
define(definition);
} else {
this[name] = definition();
}
}('UniversalPlus', function () {
var privateVar = 'I_AM_PRIVATE_VAR';
var privateFn = function () {
console.log('I am private function.');
};
// constructor
var constructor = function () {
console.log(privateVar);
privateFn();
}();
var publicFn = function () {
console.log('I am public function.');
};
return {
/**
* Public defined
*/
publicVar: 'I_AM_PUBLIC_VAR',
/**
* Public function
*/
publicFn: publicFn
};
}));