class PixeYoastContentPlugin {
    constructor() {
        YoastSEO.app.registerPlugin('pixe-builder', {status: 'ready'});

        const callback = this.addExternalContent.bind(this);
        YoastSEO.app.registerModification('content', callback, 'pixe-builder', 5);
    }

    addExternalContent(data){
        const extraText = (typeof(pixeSeo) !== 'undefined')? pixeSeo.content: '';
        return data + ' ' + extraText;
    }
}

const yoastCaller = setInterval(function(){
    if( typeof(YoastSEO) === "undefined" || typeof(YoastSEO.app) === "undefined" ){
        return false;
    }   

    new PixeYoastContentPlugin();
    clearInterval(yoastCaller);
}, 500);