🎨 Minor code structure changes

This commit is contained in:
Philipp Stracker 2024-06-12 11:27:59 +02:00
parent aa9c02a786
commit cea292684b
No known key found for this signature in database
4 changed files with 8 additions and 8 deletions

View file

@ -51,7 +51,7 @@ class ApplePayPreviewButtonManager extends PreviewButtonManager {
* @param {string} wrapperId - CSS ID of the wrapper element.
* @return {ApplePayPreviewButton}
*/
createButtonInst(wrapperId) {
createButtonInstance(wrapperId) {
return new ApplePayPreviewButton({
selector: wrapperId,
apiConfig: this.apiConfig

View file

@ -116,9 +116,9 @@ class PreviewButton {
const buttonWrapper = previewButtonConfig.button.wrapper.replace(/^#/, '')
const ppcpWrapper = this.ppcpConfig.button.wrapper.replace(/^#/, '')
if (buttonWrapper === ppcpWrapper) {
throw new Error(`[APM Preview Button] Infinite loop detected. Provide different selectors for the button/ppcp wrapper elements! Selector: "#${buttonWrapper}"`);
}
if (buttonWrapper === ppcpWrapper) {
throw new Error(`[APM Preview Button] Infinite loop detected. Provide different selectors for the button/ppcp wrapper elements! Selector: "#${buttonWrapper}"`);
}
this.createButton(previewButtonConfig)
}

View file

@ -59,8 +59,8 @@ class PreviewButtonManager {
* @param {string} wrapperId - CSS ID of the wrapper element.
* @return {PreviewButton}
*/
createButtonInst(wrapperId) {
throw new Error('The "createButtonInst" method must be implemented by the derived class');
createButtonInstance(wrapperId) {
throw new Error('The "createButtonInstance" method must be implemented by the derived class');
}
registerEventListeners() {
@ -183,7 +183,7 @@ class PreviewButtonManager {
#addButton(id, ppcpConfig) {
const createButton = () => {
if (!this.buttons[id]) {
this.buttons[id] = this.createButtonInst(id).setButtonConfig(this.buttonConfig);
this.buttons[id] = this.createButtonInstance(id).setButtonConfig(this.buttonConfig);
}
this.#configureButton(id, ppcpConfig);

View file

@ -51,7 +51,7 @@ class GooglePayPreviewButtonManager extends PreviewButtonManager {
* @param {string} wrapperId - CSS ID of the wrapper element.
* @return {GooglePayPreviewButton}
*/
createButtonInst(wrapperId) {
createButtonInstance(wrapperId) {
return new GooglePayPreviewButton({
selector: wrapperId,
apiConfig: this.apiConfig