🎨 Fully disable debug logic via WP_DEBUG

This commit is contained in:
Philipp Stracker 2024-07-24 20:47:59 +02:00
parent b9b13d7b05
commit 75f4a6f94a
No known key found for this signature in database

View file

@ -104,18 +104,20 @@ class ApplePayButton {
this.refreshContextData();
this.log = () => {};
// Debug helpers
document.ppcpApplepayButtons = document.ppcpApplepayButtons || {};
document.ppcpApplepayButtons[ this.context ] = this;
this.log = function () {
if ( ! this.buttonConfig.is_debug ) {
return;
}
console.log( `[ApplePayButton | ${ this.context }]`, ...arguments );
};
if ( this.buttonConfig.is_debug ) {
document.ppcpApplepayButtons = document.ppcpApplepayButtons || {};
document.ppcpApplepayButtons[ this.context ] = this;
this.log = function () {
console.log(
`[ApplePayButton | ${ this.context }]`,
...arguments
);
};
jQuery( document ).on( 'ppcp-applepay-debug', () => {
this.log( this );
} );