File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
src/React/Basic/DOM/Components Expand file tree Collapse file tree 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() {
8888} ;
8989
9090exports . 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
3535
3636import Data.Foldable (foldr )
3737import Effect (Effect )
38- import Effect.Unsafe (unsafePerformEffect )
3938import React.Basic (JSX , ReactComponent , element )
4039import Web.Event.Event (EventType )
4140import Web.Event.Internal.Types (Event , EventTarget )
42- import Web.HTML (window )
43- import Web.HTML.Window as Window
4441
4542type EventHandlerOptions =
4643 { capture :: Boolean
@@ -100,7 +97,7 @@ windowEvents
10097 }
10198 -> JSX
10299 -> JSX
103- windowEvents = globalEvents $ unsafePerformEffect $ map Window .toEventTarget window
100+ windowEvents = globalEvents unsafeWindowEventTarget
104101
105102windowEvent
106103 :: { eventType :: EventType
@@ -111,6 +108,8 @@ windowEvent
111108 -> JSX
112109windowEvent = windowEvents <<< pure
113110
111+ foreign import unsafeWindowEventTarget :: EventTarget
112+
114113-- | Hide "unused ffi export" warning.
115114-- | The export is required to prevent
116115-- | PS' bundler from stripping it out.
You can’t perform that action at this time.
0 commit comments