The js callback function entered by import does not return a value.

I wrote all the js about the smart contract in a js, and then called it with the js of the page. The callback function does not return a value.

Public js written by oneself
clipboard.png


index.js




localhost

clipboard.png

clipboard.png


export?


will

getuser(getuserCallBack());

Change

to

getuser(getuserCallBack);

export function getuser(getuserCallBack) {
    const result = 123456789;
    return getuserCallBack(result);
}
import {getuser} from './eosFunc';
export default function getuser(getuserCallBack) {
    const result = 123456789;
    return getuserCallBack(result);
}
import getuser from './eosFunc';

first of all, @ he's right
the reason, uh, when we look at it with type system (flow/ts), it's very clear

.
function getuser(getuserCallBack: function):any {
    const result = 123456789;
    return getuserCallBack(result);
}

function getuserCallBack(result: any):void {
    alert(result);
}

it is obvious that the parameter type accepted by the getuser method should be function, but what you fill in is getuserCallBack (), which means the execution result of the getuserCallBack function, that is, void
so, report an error


can be called after changing the original co-owned function function getuser to var getuser = function, but the public function cannot get its roomn value.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30fb6-402e6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30fb6-402e6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?