Skip to content

Commit be6b241

Browse files
committed
🐛 fixed error handle in drawIO -> Either monad
1 parent 58c7748 commit be6b241

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/placeload.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ const elementStyle = (elements, newElement) => ({
6565
// drawIO :: F -> IO -> F(IO)
6666
const drawIO = (f, _IO) => {
6767
return _IO.map((elements) => {
68-
const newElement = document.createElement('div')
69-
styl(newElement).addClass('placeload-masker')
70-
f(elementStyle(elements, newElement))
71-
return Right({...elements.value, elems: [...elements.value.elems, newElement]})
68+
return elements.map(el => {
69+
const newElement = document.createElement('div')
70+
styl(newElement).addClass('placeload-masker')
71+
f(elementStyle(elements, newElement))
72+
return {...elements.value, elems: [...elements.value.elems, newElement]}
73+
})
7274
})
7375
}
7476

@@ -100,7 +102,7 @@ const Placeload = {
100102
}
101103

102104
Placeload
103-
.$('.user-kplaceload')
105+
.$('.user-placeload')
104106
.config({speed: '2s'})
105107
.line((element) => element.width(20).height(100))
106108
.config({spaceBetween: '20px'})

0 commit comments

Comments
 (0)