Skip to content

Commit

Permalink
Migrate bs-webapi to rescript-webapi (#3544)
Browse files Browse the repository at this point in the history
* Migrate bs-webapi to rescript-webapi

* Include yarn.lock

* Revert "Include yarn.lock"

This reverts commit 18616dc.

* Add package-lock
  • Loading branch information
Ashesh3 authored Sep 27, 2022
1 parent 831fcc6 commit d63e73f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 38 deletions.
2 changes: 1 addition & 1 deletion bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"bs-dependencies": [
"@rescript/react",
"@glennsl/bs-json",
"bs-webapi",
"rescript-webapi",
"rescript-material-ui"
],
"ppx-flags": [],
Expand Down
42 changes: 11 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"@yaireo/ui-range": "^2.1.15",
"axios": "^0.27.2",
"browser-image-compression": "^2.0.0",
"bs-webapi": "^0.19.0",
"clsx": "^1.1.1",
"cross-env": "^7.0.3",
"date-fns": "^2.16.1",
Expand Down Expand Up @@ -99,6 +98,7 @@
"redux": "^4.1.0",
"redux-thunk": "^2.3.0",
"rescript-material-ui": "^2.1.2",
"rescript-webapi": "^0.6.1",
"resolve": "^1.20.0",
"save": "^2.4.0",
"screenfull": "^5.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ let make = (~id, ~value, ~updateCB, ~placeholder, ~selectables) => {
React.useEffect1(() => {
let curriedFunction = onWindowClick(showDropdown, setShowDropdown)

let removeEventListener = () => Window.removeEventListener("click", curriedFunction, window)
let removeEventListener = () => Window.removeEventListener(window, "click", curriedFunction)

if showDropdown {
Window.addEventListener("click", curriedFunction, window)
Window.addEventListener(window, "click", curriedFunction)
Some(removeEventListener)
} else {
removeEventListener()
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/utils/WindowUtils.res
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let confirm = (~onCancel=?, message, f) =>
if {
open Webapi.Dom
window |> Window.confirm(message)
window -> Window.confirm(message)
} {
f()
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ let make = (~id, ~value, ~updateCB, ~placeholder, ~selectables) => {
React.useEffect1(() => {
let curriedFunction = onWindowClick(showDropdown, setShowDropdown)

let removeEventListener = () => Window.removeEventListener("click", curriedFunction, window)
let removeEventListener = () => Window.removeEventListener(window, "click", curriedFunction)

if showDropdown {
Window.addEventListener("click", curriedFunction, window)
Window.addEventListener(window, "click", curriedFunction)
Some(removeEventListener)
} else {
removeEventListener()
Expand Down

0 comments on commit d63e73f

Please sign in to comment.