How can i add a floating window to the viewport while its getting created. When i'm trying to add with

viewport.on('add',function(){//my functionality here});it's not working..How can i add???
Any help??