How to check if tab is active?

Im using the swipable tabs and I cant check when a tab is visible/active.
I have tested with this and it doesn´t work.

app.on('tab:show', '.tab-active', function (page) {
   console.log('tab is visible');
});
$$(document).on('tab:show', '.tab-active', function() {
    console.log('tab is visible');
  });
$$(document).on('tab:show', '#tab1', function() {
    console.log('tab is visible');
  });

Thanks.

hi,

app.on('tabShow', function (e, t) {
 alert('hello from: ' + e.id)
})

eg:
jsfiddle

Thanks pvtallulah
I think I have tried that and somehow it is not working for me.
I have to try it again, thanks.