Skip to content

Commit

Permalink
💄 Gloss: Re-Arrange Code
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Mar 3, 2023
1 parent 9b8ce69 commit 356890d
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions ios/src_library/React Native/RNIModalView/RNIModalViewModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class RNIModalViewModule: RCTEventEmitter {
return false;
};

// MARK: - Event-Related
// ----------------------

private var hasListeners = false;

override func supportedEvents() -> [String]! {
Expand All @@ -34,6 +37,11 @@ class RNIModalViewModule: RCTEventEmitter {
override func stopObserving() {
self.hasListeners = false;
};

func sendModalEvent(event: Events, params: Dictionary<AnyHashable, Any>) {
guard self.hasListeners else { return };
self.sendEvent(withName: event.rawValue, body: params);
};
};

// MARK: - Standalone Functions
Expand Down Expand Up @@ -129,14 +137,3 @@ extension RNIModalViewModule {
};
};
};


// MARK: Extension - JS Events
// ---------------------------

extension RNIModalViewModule {
func sendModalEvent(event: Events, params: Dictionary<AnyHashable, Any>) {
guard self.hasListeners else { return };
self.sendEvent(withName: event.rawValue, body: params);
};
};

0 comments on commit 356890d

Please sign in to comment.