MCPcopy Create free account
hub / github.com/CrunchyData/pg_eventserv / objMove

Function objMove

examples/moving-objects/moving-objects.js:93–115  ·  view source on GitHub ↗
(objId, direction)

Source from the content-addressed store, hash-verified

91// and object id. So we do not have any actions to take
92// in the onreadystatechange method, actually.
93function objMove(objId, direction) {
94 // Re-establish the webSocket if it has
95 // been broken (system sleep, usually)
96 if (wsError) {
97 ws = setupWebSocket(wsUrl);
98 wsError = false;
99 }
100 //console.log(`move ${objId}! ${direction}`);
101 var xmlhttp = new XMLHttpRequest();
102 xmlhttp.onreadystatechange = function() {
103 if (xmlhttp.readyState == XMLHttpRequest.DONE) { // XMLHttpRequest.DONE == 4
104 if (xmlhttp.status == 200) {
105 // processed move
106 }
107 else {
108 // move failed
109 }
110 }
111 };
112 var objMoveUrl = `${fsHost}/functions/postgisftw.object_move/items.json?direction=${direction}&move_id=${objId}`;
113 xmlhttp.open("GET", objMoveUrl, true);
114 xmlhttp.send();
115}
116
117
118// Get current set of geofences from the

Callers

nothing calls this directly

Calls 1

setupWebSocketFunction · 0.85

Tested by

no test coverage detected