Created
May 10, 2017 12:48
-
-
Save svschannak/64fd9fbfeb728fddfb6365bf4cc9069b to your computer and use it in GitHub Desktop.
Example of calling a parent function in JavaScript using private function names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function mainFunction() { | |
const returnFunction = function fetchFunction(dispatch) { | |
const fetchConfig = { | |
url: '/api/endpoint/', | |
httpMethod: 'get', | |
successStatusCode: 200, | |
successCallback: (res) => { | |
//execute if successful | |
}, | |
errorCallback: (err) => { | |
// wait and try the function again | |
setTimeout(fetchFunction(dispatch), 500); | |
} | |
}; | |
dispatchFetch(fetchConfig); | |
} | |
return (dispatch) => returnFunction(dispatch); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment