diff --git a/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java b/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java index cb5c01c..5414259 100644 --- a/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java +++ b/android/src/main/java/sqip/react/SquareInAppPaymentsModule.java @@ -47,4 +47,24 @@ public void run() { } }); } + + @ReactMethod + public void addListener(String eventName) { + if (!listeners.containsKey(eventName)) { + listeners.put(eventName, 1); + } else { + listeners.put(eventName, listeners.get(eventName) + 1); + } } + + @ReactMethod + public void removeListeners(Integer count) { + for (Map.Entry entry : listeners.entrySet()) { + int currentCount = entry.getValue(); + if (currentCount <= count) { + listeners.remove(entry.getKey()); + } else { + listeners.put(entry.getKey(), currentCount - count); + } + } } } +