File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,16 @@ import React
55class BgReactNativeTorch : RCTEventEmitter {
66 @objc dynamic var device : AVCaptureDevice ? = AVCaptureDevice . default ( for: AVMediaType . video)
77 var observer : BgReactNativeTorchObserver ? = nil
8+ public static var sharedEmitter : BgReactNativeTorch ?
89
910 /// Initialise the module, setting the device using AVCaptureDevice.default
1011 ///
1112 /// - Returns: A BgReactNativeTorch object to control the torch
1213 override init ( ) {
14+ super. init ( )
15+ BgReactNativeTorch . sharedEmitter = self
1316 self . device = AVCaptureDevice . default ( for: AVMediaType . video)
1417 self . observer = nil
15- super. init ( )
1618 }
1719
1820 /// Initialise the module, using the passed arguments to set device and observer
@@ -97,7 +99,7 @@ class BgReactNativeTorch: RCTEventEmitter {
9799
98100 /// Emit the current enabled and availability states of the torch
99101 func emitEvent( ) {
100- sendEvent (
102+ BgReactNativeTorch . sharedEmitter ? . sendEvent (
101103 withName: " TorchStateChange " ,
102104 body: [
103105 " available " : checkAvailabilityState ( ) ,
You can’t perform that action at this time.
0 commit comments