File tree 3 files changed +10
-3
lines changed
3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ require by default look for these extensions chronologically -
7
7
8
8
*/
9
9
10
- const { send } = require ( "./request" ) ; // ES6 destructuring
10
+ const { send, REQUEST_TIMEOUT } = require ( "./request" ) ; // ES6 destructuring
11
11
const { read } = require ( "./response" ) ;
12
12
13
13
/*
@@ -29,4 +29,8 @@ function makeRequest(url, data) {
29
29
}
30
30
31
31
const responseData = makeRequest ( "https:www.google.com" , "Hello" ) ;
32
- console . log ( responseData ) ;
32
+
33
+ // Just to use REQUEST_TIMEOUT
34
+ setTimeout ( ( ) => {
35
+ console . log ( responseData ) ;
36
+ } , REQUEST_TIMEOUT ) ;
Original file line number Diff line number Diff line change
1
+ const REQUEST_TIMEOUT = 500 ;
2
+
1
3
function encrypt ( data ) {
2
4
return "encrypted data" ;
3
5
}
@@ -11,6 +13,7 @@ module.exports = {
11
13
// send: send
12
14
// requestSend: send, // if exporting function with different name
13
15
send, // if exporting function with same name
16
+ REQUEST_TIMEOUT , // variable exporting
14
17
} ;
15
18
16
19
console . log ( module ) ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ exports.requestRead = read
25
25
26
26
or even better,
27
27
28
- exports.read() {
28
+ exports.read = function read() {
29
29
return decrypt("data")
30
30
}
31
31
You can’t perform that action at this time.
0 commit comments