0

I have this function, uisetting.getJson is an async function that is used here columnWidth. In then closure, I update its value, but string "go setting, col width from settings" is never printed, even when I get value of width.

function columnWidth (index) {

  let stored_width
  uisetting.getJson(props.storageKey + '.' + index).then(width => {
    console.log('get json width', width)
    stored_width = width
  })
  if (stored_width != null) {
    console.log(' go setting, col width from settings: ', stored_width)
    return { width: stored_width }
  }
 
  return { width: 100 }
}
cHiWa
  • 383
  • 1
  • 3
  • 14

0 Answers0