tabshow events in javascript and ui - which runs first?

If I have an .on(‘tabshow’) event in inline javascript, and I have ‘Whenever tab shown’ actions in the ui, which will run first? Will one always run before the other, or does it depend on the scenario?

Thanks!