@@ -38,10 +38,9 @@ module Web.HTML.Window
38
38
) where
39
39
40
40
import Data.Maybe (Maybe )
41
- import Data.Newtype (class Newtype , unwrap )
42
41
import Data.Nullable (Nullable , toMaybe )
43
42
import Effect (Effect )
44
- import Prelude (class Eq , class Ord , Unit , (<$>), (<<<), map )
43
+ import Prelude (class Eq , class Ord , Unit , (<$>))
45
44
import Unsafe.Coerce (unsafeCoerce )
46
45
import Web.Event.EventTarget (EventTarget )
47
46
import Web.HTML.HTMLDocument (HTMLDocument )
@@ -121,37 +120,23 @@ foreign import sessionStorage :: Window -> Effect Storage
121
120
122
121
newtype RequestAnimationFrameId = RequestAnimationFrameId Int
123
122
124
- derive instance newtypeRequestAnimationFrameId :: Newtype RequestAnimationFrameId _
125
123
derive instance eqRequestAnimationFrameId :: Eq RequestAnimationFrameId
126
124
derive instance ordRequestAnimationFrameId :: Ord RequestAnimationFrameId
127
125
128
- foreign import _requestAnimationFrame :: Effect Unit -> Window -> Effect Int
126
+ foreign import requestAnimationFrame :: Effect Unit -> Window -> Effect RequestAnimationFrameId
129
127
130
- requestAnimationFrame :: Effect Unit -> Window -> Effect RequestAnimationFrameId
131
- requestAnimationFrame fn = map RequestAnimationFrameId <<< _requestAnimationFrame fn
132
-
133
- foreign import _cancelAnimationFrame :: Int -> Window -> Effect Unit
134
-
135
- cancelAnimationFrame :: RequestAnimationFrameId -> Window -> Effect Unit
136
- cancelAnimationFrame idAF = _cancelAnimationFrame (unwrap idAF)
128
+ foreign import cancelAnimationFrame :: RequestAnimationFrameId -> Window -> Effect Unit
137
129
138
130
newtype RequestIdleCallbackId = RequestIdleCallbackId Int
139
131
140
- derive instance newtypeRequestIdleCallbackId :: Newtype RequestIdleCallbackId _
141
132
derive instance eqRequestIdleCallbackId :: Eq RequestIdleCallbackId
142
133
derive instance ordRequestIdleCallbackId :: Ord RequestIdleCallbackId
143
134
144
- foreign import _requestIdleCallback :: { timeout :: Int } -> Effect Unit -> Window -> Effect Int
145
-
146
135
-- | Set timeout to `0` to get the same behaviour as when it is `undefined` in
147
136
-- | [JavaScript](https://w3c.github.io/requestidlecallback/#h-the-requestidle-callback-method).
148
- requestIdleCallback :: { timeout :: Int } -> Effect Unit -> Window -> Effect RequestIdleCallbackId
149
- requestIdleCallback opts fn = map RequestIdleCallbackId <<< _requestIdleCallback opts fn
150
-
151
- foreign import _cancelIdleCallback :: Int -> Window -> Effect Unit
137
+ foreign import requestIdleCallback :: { timeout :: Int } -> Effect Unit -> Window -> Effect RequestIdleCallbackId
152
138
153
- cancelIdleCallback :: RequestIdleCallbackId -> Window -> Effect Unit
154
- cancelIdleCallback idAF = _cancelIdleCallback (unwrap idAF)
139
+ foreign import cancelIdleCallback :: RequestIdleCallbackId -> Window -> Effect Unit
155
140
156
141
foreign import parent :: Window -> Effect Window
157
142
0 commit comments