Skip to content

Commit 942a412

Browse files
authored
Merge pull request #39 from kl0tl/fix-hidden-constructors-warnings
Fix `HiddenConstructors` warnings
2 parents dad3c35 + ad504b8 commit 942a412

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

src/Web/HTML/Window.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -188,23 +188,23 @@ exports.sessionStorage = function (window) {
188188
};
189189
};
190190

191-
exports._requestAnimationFrame = function(fn) {
191+
exports.requestAnimationFrame = function(fn) {
192192
return function(window) {
193193
return function() {
194194
return window.requestAnimationFrame(fn);
195195
};
196196
};
197197
};
198198

199-
exports._cancelAnimationFrame = function(id) {
199+
exports.cancelAnimationFrame = function(id) {
200200
return function(window) {
201201
return function() {
202202
return window.cancelAnimationFrame(id);
203203
};
204204
};
205205
};
206206

207-
exports._requestIdleCallback = function(opts) {
207+
exports.requestIdleCallback = function(opts) {
208208
return function(fn) {
209209
return function(window) {
210210
return function() {
@@ -214,7 +214,7 @@ exports._requestIdleCallback = function(opts) {
214214
};
215215
};
216216

217-
exports._cancelIdleCallback = function(id) {
217+
exports.cancelIdleCallback = function(id) {
218218
return function(window) {
219219
return function() {
220220
return window.cancelIdleCallback(id);

src/Web/HTML/Window.purs

+5-20
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ module Web.HTML.Window
3838
) where
3939

4040
import Data.Maybe (Maybe)
41-
import Data.Newtype (class Newtype, unwrap)
4241
import Data.Nullable (Nullable, toMaybe)
4342
import Effect (Effect)
44-
import Prelude (class Eq, class Ord, Unit, (<$>), (<<<), map)
43+
import Prelude (class Eq, class Ord, Unit, (<$>))
4544
import Unsafe.Coerce (unsafeCoerce)
4645
import Web.Event.EventTarget (EventTarget)
4746
import Web.HTML.HTMLDocument (HTMLDocument)
@@ -121,37 +120,23 @@ foreign import sessionStorage :: Window -> Effect Storage
121120

122121
newtype RequestAnimationFrameId = RequestAnimationFrameId Int
123122

124-
derive instance newtypeRequestAnimationFrameId :: Newtype RequestAnimationFrameId _
125123
derive instance eqRequestAnimationFrameId :: Eq RequestAnimationFrameId
126124
derive instance ordRequestAnimationFrameId :: Ord RequestAnimationFrameId
127125

128-
foreign import _requestAnimationFrame :: Effect Unit -> Window -> Effect Int
126+
foreign import requestAnimationFrame :: Effect Unit -> Window -> Effect RequestAnimationFrameId
129127

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
137129

138130
newtype RequestIdleCallbackId = RequestIdleCallbackId Int
139131

140-
derive instance newtypeRequestIdleCallbackId :: Newtype RequestIdleCallbackId _
141132
derive instance eqRequestIdleCallbackId :: Eq RequestIdleCallbackId
142133
derive instance ordRequestIdleCallbackId :: Ord RequestIdleCallbackId
143134

144-
foreign import _requestIdleCallback :: { timeout :: Int } -> Effect Unit -> Window -> Effect Int
145-
146135
-- | Set timeout to `0` to get the same behaviour as when it is `undefined` in
147136
-- | [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
152138

153-
cancelIdleCallback :: RequestIdleCallbackId -> Window -> Effect Unit
154-
cancelIdleCallback idAF = _cancelIdleCallback (unwrap idAF)
139+
foreign import cancelIdleCallback :: RequestIdleCallbackId -> Window -> Effect Unit
155140

156141
foreign import parent :: Window -> Effect Window
157142

0 commit comments

Comments
 (0)