File tree 2 files changed +11
-4
lines changed
src/React/Basic/DOM/Components
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -88,3 +88,11 @@ GlobalEvent.prototype.render = function() {
88
88
} ;
89
89
90
90
exports . globalEvent_ = GlobalEvent ;
91
+
92
+ exports . unsafeWindowEventTarget = ( function ( ) {
93
+ if ( typeof window === "undefined" ) {
94
+ return undefined ;
95
+ } else {
96
+ return window ;
97
+ }
98
+ } ) ( ) ;
Original file line number Diff line number Diff line change @@ -35,12 +35,9 @@ import Prelude
35
35
36
36
import Data.Foldable (foldr )
37
37
import Effect (Effect )
38
- import Effect.Unsafe (unsafePerformEffect )
39
38
import React.Basic (JSX , ReactComponent , element )
40
39
import Web.Event.Event (EventType )
41
40
import Web.Event.Internal.Types (Event , EventTarget )
42
- import Web.HTML (window )
43
- import Web.HTML.Window as Window
44
41
45
42
type EventHandlerOptions =
46
43
{ capture :: Boolean
@@ -100,7 +97,7 @@ windowEvents
100
97
}
101
98
-> JSX
102
99
-> JSX
103
- windowEvents = globalEvents $ unsafePerformEffect $ map Window .toEventTarget window
100
+ windowEvents = globalEvents unsafeWindowEventTarget
104
101
105
102
windowEvent
106
103
:: { eventType :: EventType
@@ -111,6 +108,8 @@ windowEvent
111
108
-> JSX
112
109
windowEvent = windowEvents <<< pure
113
110
111
+ foreign import unsafeWindowEventTarget :: EventTarget
112
+
114
113
-- | Hide "unused ffi export" warning.
115
114
-- | The export is required to prevent
116
115
-- | PS' bundler from stripping it out.
You can’t perform that action at this time.
0 commit comments