-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsharedModule.js
More file actions
27 lines (24 loc) · 818 Bytes
/
sharedModule.js
File metadata and controls
27 lines (24 loc) · 818 Bytes
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
// All the code in this module is
// enclosed in closure
(function(exports) {
// Helper function
function executeOnClick(){
// Function to be exposed
var myElem = document.getElementByID('submit');
myElem.onclick = function createObj2() {
var username = document.getElementById("username");
var password = document.getElementById("password");
const obj = [{"username " : `${username}`,
"password" : `${password}`}];
console.log(obj);
return obj;
}
}
// Export the function to exports
// In node.js this will be exports
// the module.exports
// In browser this will be function in
// the global object sharedModule
exports.executeOnClick = executeOnClick;
})(typeof exports === 'undefined'?
this['sharedModule']={}: exports);