<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script src="main.js"></script>
<script>
test('test');
</script>
</body>
</html>
import callback_f from './callback_f'
import callback_s from './fcallback_s'
const test = (props) => {
let first = 'first';
callback_f(first,(result)=>callback_s(result,first,props));
}
export default test;
const callback_f = (first,callback) => {
let result = {};
result.first = first;
return callback(result);
}
export default callback_f;
const callback_f = (result,first,props) => {
console.log(`result is "${result}" and first is ${first} and props is ${props}`);
}
export default callback_s;
参考
https://qiita.com/Lewuathe/items/5827a9b429aa71c4f76e
http://blog.enjoitech.com/article/222