looking for some solutions? You are welcome.

SOLVED: How do i pass result of callback into variable and access the var freely

flix:

I know there's a ton of question similar to my question, but i didn't see any good case to help me,

I have a callback from native function bridge and this how i used it on JS:

getAllParameter((data)=>{
  console.log(data) // data is Javascript Object
})

I've tried this to get the value of data:

getAllParameter((data)=>{
  return new Promise((resolve)=> resolve(showToken(data.Token)))
})

async function showToken(token){
  var res = await token
  return res
}

var isiToken = showToken()
console.log("isiToken")
console.log(isiToken)

but the result is:

isiToken
{ _40: 0, _65: 0, _55: null, _72: null }

i don't know whats wrong with my code, i want to get the value of data outside of the getAllParameter, how can i do that properly?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent