Can't find method java.util.Timer.schedule with setTimeout

120 Views Asked by At

I'm programming a JavaScript app

in the app there is a button when the user clicks on it, a door supposed to be opened for 7 seconds then close again

that's my code :

if (cmd == "clickOnButton") {
  var rVars = []
  rVars.push({
    name: "door",
    val: 1
  }) // 1 for opening , 0 for closing

  _server.setRoomVariables(r, user, rVars)

  function closethedoor() {

    var rVars = []
    rVars.push({
      name: "door",
      val: 0
    })
    _server.setRoomVariables(r, user, rVars)
  }
  setTimeout(closethedoor, 7000);
}

the door open successfully but it doesn't close after 7 seconds , that's the problem I found:

Can't find method java.util.Timer.schedule(adapter1,org.mozilla.javascript.Undefined).

Using smart fox server pro

0

There are 0 best solutions below