UNPKG

wonder.js

Version:
132 lines (109 loc) 6.25 kB
'use strict'; var Caml_array = require("bs-platform/lib/js/caml_array.js"); var Caml_option = require("bs-platform/lib/js/caml_option.js"); var BindCustomEventMainService$Wonderjs = require("./bind/BindCustomEventMainService.js"); var BindMouseDomEventMainService$Wonderjs = require("./bind/BindMouseDomEventMainService.js"); var BindTouchDomEventMainService$Wonderjs = require("./bind/BindTouchDomEventMainService.js"); var HandleCustomEventMainService$Wonderjs = require("./handle/HandleCustomEventMainService.js"); var BindKeyboardDomEventMainService$Wonderjs = require("./bind/BindKeyboardDomEventMainService.js"); function onMouseEvent(eventName, handleFunc, state, $staropt$star, param) { var priority = $staropt$star !== undefined ? $staropt$star : 0; return BindMouseDomEventMainService$Wonderjs.bind(eventName, priority, handleFunc, state); } function onKeyboardEvent(eventName, handleFunc, state, $staropt$star, param) { var priority = $staropt$star !== undefined ? $staropt$star : 0; return BindKeyboardDomEventMainService$Wonderjs.bind(eventName, priority, handleFunc, state); } function onTouchEvent(eventName, handleFunc, state, $staropt$star, param) { var priority = $staropt$star !== undefined ? $staropt$star : 0; return BindTouchDomEventMainService$Wonderjs.bind(eventName, priority, handleFunc, state); } var offMouseEventByHandleFunc = BindMouseDomEventMainService$Wonderjs.unbindByHandleFunc; var offKeyboardEventByHandleFunc = BindKeyboardDomEventMainService$Wonderjs.unbindByHandleFunc; var offTouchEventByHandleFunc = BindTouchDomEventMainService$Wonderjs.unbindByHandleFunc; function onCustomGlobalEvent(eventName, handleFunc, state, $staropt$star, param) { var priority = $staropt$star !== undefined ? $staropt$star : 0; return BindCustomEventMainService$Wonderjs.bindGlobalEvent(eventName, priority, handleFunc, state); } var offCustomGlobalEventByEventName = BindCustomEventMainService$Wonderjs.unbindGlobalEventByEventName; var offCustomGlobalEventByHandleFunc = BindCustomEventMainService$Wonderjs.unbindGlobalEventByHandleFunc; function onCustomGameObjectEvent(eventName, handleFunc, target, state, $staropt$star, param) { var priority = $staropt$star !== undefined ? $staropt$star : 0; return BindCustomEventMainService$Wonderjs.bindGameObjectEvent(/* tuple */[ eventName, priority, target ], handleFunc, state); } function offCustomGameObjectEventByTarget(eventName, target, state) { return BindCustomEventMainService$Wonderjs.unbindGameObjectEventByTarget(/* tuple */[ eventName, target ], state); } function offCustomGameObjectEventByHandleFunc(eventName, handleFunc, target, state) { return BindCustomEventMainService$Wonderjs.unbindGameObjectEventByHandleFunc(/* tuple */[ eventName, target ], handleFunc, state); } var stopPropagationCustomEvent = HandleCustomEventMainService$Wonderjs.stopPropagation; var triggerCustomGlobalEvent = HandleCustomEventMainService$Wonderjs.triggerGlobalEvent; function triggerCustomGameObjectEvent(customEvent, target, state) { return HandleCustomEventMainService$Wonderjs.triggerGameObjectEvent(target, customEvent, state); } function broadcastCustomGameObjectEvent(customEvent, target, state) { return HandleCustomEventMainService$Wonderjs.broadcastGameObjectEvent(target, customEvent, state); } function emitCustomGameObjectEvent(customEvent, target, state) { return HandleCustomEventMainService$Wonderjs.emitGameObjectEvent(target, customEvent, state); } function setDomEventStreamSubscription(domEventStreamSubscription, state) { var eventRecord = state[/* eventRecord */43]; var newrecord = Caml_array.caml_array_dup(state); newrecord[/* eventRecord */43] = /* record */[ /* domEventStreamSubscription */Caml_option.some(domEventStreamSubscription), /* mouseDomEventDataArrMap */eventRecord[/* mouseDomEventDataArrMap */1], /* keyboardDomEventDataArrMap */eventRecord[/* keyboardDomEventDataArrMap */2], /* touchDomEventDataArrMap */eventRecord[/* touchDomEventDataArrMap */3], /* customGlobalEventArrMap */eventRecord[/* customGlobalEventArrMap */4], /* customGameObjectEventArrMap */eventRecord[/* customGameObjectEventArrMap */5], /* mouseEventData */eventRecord[/* mouseEventData */6], /* keyboardEventData */eventRecord[/* keyboardEventData */7], /* touchEventData */eventRecord[/* touchEventData */8] ]; return newrecord; } function _unsubscribeDomEventStream (domEventStreamSubscription){ domEventStreamSubscription.unsubscribe(); }; function unsubscribeDomEventStream(state) { var match = state[/* eventRecord */43][/* domEventStreamSubscription */0]; if (match !== undefined) { _unsubscribeDomEventStream(Caml_option.valFromOption(match)); return state; } else { return state; } } exports.onMouseEvent = onMouseEvent; exports.onKeyboardEvent = onKeyboardEvent; exports.onTouchEvent = onTouchEvent; exports.offMouseEventByHandleFunc = offMouseEventByHandleFunc; exports.offKeyboardEventByHandleFunc = offKeyboardEventByHandleFunc; exports.offTouchEventByHandleFunc = offTouchEventByHandleFunc; exports.onCustomGlobalEvent = onCustomGlobalEvent; exports.offCustomGlobalEventByEventName = offCustomGlobalEventByEventName; exports.offCustomGlobalEventByHandleFunc = offCustomGlobalEventByHandleFunc; exports.onCustomGameObjectEvent = onCustomGameObjectEvent; exports.offCustomGameObjectEventByTarget = offCustomGameObjectEventByTarget; exports.offCustomGameObjectEventByHandleFunc = offCustomGameObjectEventByHandleFunc; exports.stopPropagationCustomEvent = stopPropagationCustomEvent; exports.triggerCustomGlobalEvent = triggerCustomGlobalEvent; exports.triggerCustomGameObjectEvent = triggerCustomGameObjectEvent; exports.broadcastCustomGameObjectEvent = broadcastCustomGameObjectEvent; exports.emitCustomGameObjectEvent = emitCustomGameObjectEvent; exports.setDomEventStreamSubscription = setDomEventStreamSubscription; exports._unsubscribeDomEventStream = _unsubscribeDomEventStream; exports.unsubscribeDomEventStream = unsubscribeDomEventStream; /* BindCustomEventMainService-Wonderjs Not a pure module */