@@ -121,11 +121,14 @@ let DefaultLiveQueryController = {
121121 sessionToken,
122122 } ) ;
123123 // Register a default onError callback to make sure we do not crash on error
124+ // Cannot create these events on a nested way because of EventEmiiter from React Native
124125 defaultLiveQueryClient . on ( 'error' , ( error ) => {
125126 LiveQuery . emit ( 'error' , error ) ;
126- } ) . on ( 'open' , ( ) => {
127+ } ) ;
128+ defaultLiveQueryClient . on ( 'open' , ( ) => {
127129 LiveQuery . emit ( 'open' ) ;
128- } ) . on ( 'close' , ( ) => {
130+ } ) ;
131+ defaultLiveQueryClient . on ( 'close' , ( ) => {
129132 LiveQuery . emit ( 'close' ) ;
130133 } ) ;
131134
@@ -160,18 +163,23 @@ let DefaultLiveQueryController = {
160163 subscriptionWrap . query = subscription . query ;
161164 subscriptionWrap . sessionToken = subscription . sessionToken ;
162165 subscriptionWrap . unsubscribe = subscription . unsubscribe ;
163-
166+ // Cannot create these events on a nested way because of EventEmiiter from React Native
164167 subscription . on ( 'open' , ( ) => {
165168 subscriptionWrap . emit ( 'open' ) ;
166- } ) . on ( 'create' , ( object ) => {
169+ } ) ;
170+ subscription . on ( 'create' , ( object ) => {
167171 subscriptionWrap . emit ( 'create' , object ) ;
168- } ) . on ( 'update' , ( object ) => {
172+ } ) ;
173+ subscription . on ( 'update' , ( object ) => {
169174 subscriptionWrap . emit ( 'update' , object ) ;
170- } ) . on ( 'enter' , ( object ) => {
175+ } ) ;
176+ subscription . on ( 'enter' , ( object ) => {
171177 subscriptionWrap . emit ( 'enter' , object ) ;
172- } ) . on ( 'leave' , ( object ) => {
178+ } ) ;
179+ subscription . on ( 'leave' , ( object ) => {
173180 subscriptionWrap . emit ( 'leave' , object ) ;
174- } ) . on ( 'delete' , ( object ) => {
181+ } ) ;
182+ subscription . on ( 'delete' , ( object ) => {
175183 subscriptionWrap . emit ( 'delete' , object ) ;
176184 } ) ;
177185
0 commit comments