15 lines
273 B
JavaScript
15 lines
273 B
JavaScript
|
function onInit() {
|
||
|
rpc.register("doSomethingLong", doSomethingLong)
|
||
|
}
|
||
|
|
||
|
function doSomethingLong(ctx, params) {
|
||
|
var start = Date.now()
|
||
|
|
||
|
while (true) {
|
||
|
var now = Date.now()
|
||
|
if (now - start >= params.delay) break
|
||
|
}
|
||
|
|
||
|
return params.i;
|
||
|
}
|