Code example not work

Hi, I have tested this code in a config.html file, and it doesn’t execute any code in “configureExtension”

// all extension need onAuthorized
window.Twitch.ext.onAuthorized(auth => {
});

// onChanged will recieve the configuration
// but only when first called/extension is loaded
window.Twitch.ext.configuration.onChanged(() => {
    var global_config = window.Twitch.ext.configuration.global;
    if (global_config) {
        try {
            global_config.content = JSON.parse(global_config.content);
            configureExtension(global_config.content);
        } catch (e) {
            // this accounts for JSON parse errors
            // just in case
        }
    }
});


// central function to accept the config from whichever source
function configureExtension(the_config) {
    // do whatever you want with your config
    // (re)build the extension
}

// central function to accept the config from whichever source
function configureExtension(the_config) {
document.getElementById(“idelement”).value=“test OK!!!”;
}

and never execute this code

The code you have posted will only do something if you have stored something in the global segment.

i don’t understand…if onchange execute first load…there is nothing saved

onChanged will execute if you have the config service enabled.

But the

if (global_config) { will only trigger if window.Twitch.ext.configuration.global is not undefined.

As I covered in the other thread where I linked this example, you need to substitute global for the other config segments, depending on which segment you are storing the config you wish to recall in

ok,ok i test with broadcaster…and developer…same result…no execute code

and i test configure version segment with “1” and no value in version value and no execute code

Not sure what the issue is then

This code is basically what I use in released extensions.

You’ll have to debug/trace it back and find where the problem is.