lib/firebase/fquery.rb in motion-firebase-3.2.0 vs lib/firebase/fquery.rb in motion-firebase-3.2.1
- old
+ new
@@ -130,12 +130,17 @@
elsif options[:equal_to]
fb_query = fb_query.queryEqualToValue(options[:equal_to])
end
if block
- event_type = options.fetch(:on, FEventTypeValue)
+ event_type = options.fetch(:once, options.fetch(:on, FEventTypeValue))
event_type = Firebase.convert_event_type(event_type)
- return fb_query.observeEventType(event_type, withBlock: block)
+
+ if options.key?(:once)
+ return fb_query.observeSingleEventOfType(event_type, withBlock: block)
+ else
+ return fb_query.observeEventType(event_type, withBlock: block)
+ end
else
fb_query
end
end