Search code examples
javascriptimmersive-reader

Immersive Reader onPreferencesChanged event not firing as preferences are changing


In this javascript code which calls the immersive reader SDK, the onExit fires as expected, but the onPreferencesChanged never fires. What am I missing here?

async function LaunchImmersiveReader(title) {
    const data = {
        title: title,
        chunks: [{
            content: title,
            lang: 'en'
        }]
    };

    const token = await getImmersiveReaderTokenAsync();
    const subdomain = await getImmersiveReaderSubdomainAsync();

    const options = {            
        onPreferencesChanged: onPreferencesChangedCallback,
        onExit: exitCallback
    };
    

    ImmersiveReader.launchAsync(token, subdomain, data, options);
}

function exitCallback() {
// this fires as I click the immersive reader exit/back button
}


function onPreferencesChangedCallback(value) {
// this never fires as I change font, size, etc.
}

Solution

  • What version of the SDK are you using? The preferences callback is part of 1.1.0

    I did notice that a lot of our sample projects and documentation is using 1.0.0 still, which might be leading to the confusion