@@ -58,6 +58,9 @@ var LibraryHTML5 = {
58
58
currentEventHandler: null,
59
59
#endif
60
60
*/
61
+ memcpy ( target , src , size ) {
62
+ HEAP8 . set ( HEAP8 . subarray ( src , src + size ) , target ) ;
63
+ } ,
61
64
62
65
removeAllEventListeners ( ) {
63
66
while ( JSEvents . eventHandlers . length ) {
@@ -594,7 +597,7 @@ var LibraryHTML5 = {
594
597
// HTML5 does not really have a polling API for mouse events, so implement one manually by
595
598
// returning the data from the most recently received event. This requires that user has registered
596
599
// at least some no-op function as an event handler to any of the mouse function.
597
- HEAP8 . set ( HEAP8 . subarray ( JSEvents . mouseEvent , JSEvents . mouseEvent + { { { C_STRUCTS . EmscriptenMouseEvent . __size__ } } } ) , mouseState ) ;
600
+ JSEvents . memcpy ( mouseState , JSEvents . mouseEvent , { { { C_STRUCTS . EmscriptenMouseEvent . __size__ } } } ) ;
598
601
return { { { cDefs . EMSCRIPTEN_RESULT_SUCCESS } } } ;
599
602
} ,
600
603
@@ -852,7 +855,7 @@ var LibraryHTML5 = {
852
855
// HTML5 does not really have a polling API for device orientation events, so implement one manually by
853
856
// returning the data from the most recently received event. This requires that user has registered
854
857
// at least some no-op function as an event handler.
855
- HEAP32 . set ( HEAP32 . subarray ( JSEvents . deviceOrientationEvent , { { { C_STRUCTS . EmscriptenDeviceOrientationEvent . __size__ } } } ) , orientationState ) ;
858
+ JSEvents . memcpy ( orientationState , JSEvents . deviceOrientationEvent , { { { C_STRUCTS . EmscriptenDeviceOrientationEvent . __size__ } } } ) ;
856
859
return { { { cDefs . EMSCRIPTEN_RESULT_SUCCESS } } } ;
857
860
} ,
858
861
@@ -922,7 +925,7 @@ var LibraryHTML5 = {
922
925
// HTML5 does not really have a polling API for device motion events, so implement one manually by
923
926
// returning the data from the most recently received event. This requires that user has registered
924
927
// at least some no-op function as an event handler.
925
- HEAP32 . set ( HEAP32 . subarray ( JSEvents . deviceMotionEvent , { { { C_STRUCTS . EmscriptenDeviceMotionEvent . __size__ } } } ) , motionState ) ;
928
+ JSEvents . memcpy ( motionState , JSEvents . deviceMotionEvent , { { { C_STRUCTS . EmscriptenDeviceMotionEvent . __size__ } } } ) ;
926
929
return { { { cDefs . EMSCRIPTEN_RESULT_SUCCESS } } } ;
927
930
} ,
928
931
0 commit comments