getRole() always return none, no moderator is set

When I join a room with no users, moderator role is not set and getRole() always returns none

I am using following connection options

const options = {
    hosts: {
        domain: '',
        muc: '',
        focus: '',
    externalConnectUrl: '',
    enableP2P: true,
    p2p: {
        enabled: true,
        preferH264: true,
        disableH264: true,
        useStunTurn: true,
    useStunTurn: true,
    bosh: ``,
    websocket: 'wss://',
    clientNode: '',

Changing the role happens after joining. Checkout the API for
api.addEventListener('participantRoleChanged', function(event) {