mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🎨 Fully disable debug logic via WP_DEBUG
This commit is contained in:
parent
b9b13d7b05
commit
75f4a6f94a
1 changed files with 12 additions and 10 deletions
|
@ -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 );
|
||||
} );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue