Skip to content
Permalink
Browse files

fix(event): bind mobile event use {"passive": false}

  • Loading branch information...
yyc-git committed May 11, 2019
1 parent ee51005 commit 5464e01ad3bcf83041c6c150f9bb10d11aa423fd
Showing with 13 additions and 12 deletions.
  1. +13 −12 src/job/utils/InitEventJobUtils.re
@@ -7,13 +7,14 @@ let _getBody = () => DomExtend.document##body |> bodyToEventTarget;
let _fromPointDomEvent = (eventName, state) =>
WonderBsMost.Most.fromEvent(eventName, _getBody(), false);

let _fromMobilePointDomEvent = eventName => {
let fromEvent = Obj.magic(WonderBsMost.Most.fromEvent);

fromEvent(eventName, _getBody(), {"passive": false});
};

let _fromTouchMoveDomEventAndPreventnDefault = state =>
Obj.magic(
WonderBsMost.Most.fromEvent,
"touchmove",
_getBody(),
{"passive": false},
)
_fromMobilePointDomEvent("touchmove")
|> WonderBsMost.Most.tap(event =>
HandlePointDomEventMainService.preventDefault(
event |> eventTargetToTouchDomEvent |> touchDomEventToPointDomEvent,
@@ -419,23 +420,23 @@ let _fromPCDomEventArr = state => [|
|];

let _fromMobileDomEventArr = state => [|
_fromPointDomEvent("touchend", state)
|> WonderBsMost.Most.since(_fromPointDomEvent("touchstart", state))
_fromMobilePointDomEvent("touchend")
|> WonderBsMost.Most.since(_fromMobilePointDomEvent("touchstart"))
|> WonderBsMost.Most.tap(event => _execTouchEventHandle(TouchTap, event)),
_fromPointDomEvent("touchend", state)
_fromMobilePointDomEvent("touchend")
|> WonderBsMost.Most.tap(event => _execTouchEventHandle(TouchEnd, event)),
_fromPointDomEvent("touchstart", state)
_fromMobilePointDomEvent("touchstart")
|> WonderBsMost.Most.tap(event => _execTouchEventHandle(TouchStart, event)),
_fromTouchMoveDomEventAndPreventnDefault(state)
|> WonderBsMost.Most.tap(event =>
_execTouchMoveEventHandle(TouchMove, event)
),
_fromPointDomEvent("touchstart", state)
_fromMobilePointDomEvent("touchstart")
|> WonderBsMost.Most.tap(event => _execTouchDragStartEventHandle(event))
|> WonderBsMost.Most.flatMap(event =>
_fromTouchMoveDomEventAndPreventnDefault(state)
|> WonderBsMost.Most.until(
_fromPointDomEvent("touchend", state)
_fromMobilePointDomEvent("touchend")
|> WonderBsMost.Most.tap(event =>
_execTouchDragDropEventHandle(event)
),

0 comments on commit 5464e01

Please sign in to comment.
You can’t perform that action at this time.