dmon now only watches top level directory; user must call dmon.watch and supply a dmon watch function
Some checks failed
Build and Deploy / build-linux (push) Successful in 1m7s
Build and Deploy / package-dist (push) Has been cancelled
Build and Deploy / deploy-itch (push) Has been cancelled
Build and Deploy / deploy-gitea (push) Has been cancelled
Build and Deploy / build-windows (CLANG64) (push) Has been cancelled
Some checks failed
Build and Deploy / build-linux (push) Successful in 1m7s
Build and Deploy / package-dist (push) Has been cancelled
Build and Deploy / deploy-itch (push) Has been cancelled
Build and Deploy / deploy-gitea (push) Has been cancelled
Build and Deploy / build-windows (CLANG64) (push) Has been cancelled
This commit is contained in:
@@ -14,7 +14,12 @@ var frame_t = 0
|
||||
var fpses = []
|
||||
var timescale = 1
|
||||
|
||||
var dmon = use('dmon')
|
||||
|
||||
function step() {
|
||||
if (dmon)
|
||||
dmon.poll(prosperon.dmon)
|
||||
|
||||
var now = os.now()
|
||||
var dt = now - last_frame_time
|
||||
if (dt < waittime) os.sleep(waittime - dt)
|
||||
|
||||
@@ -417,11 +417,6 @@ static BufferCheckResult get_or_extend_buffer(
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#if (defined(_WIN32) || defined(__WIN32__))
|
||||
#include <direct.h>
|
||||
#define mkdir(x,y) _mkdir(x)
|
||||
#endif
|
||||
|
||||
struct lrtb {
|
||||
float l;
|
||||
float r;
|
||||
|
||||
@@ -72,8 +72,7 @@ JSValue js_dmon_watch(JSContext *js, JSValue self, int argc, JSValue *argv)
|
||||
if (watched.id)
|
||||
return JS_ThrowReferenceError(js, "Already watching a directory.");
|
||||
|
||||
const char *dir = JS_ToCString(js,argv[0]);
|
||||
watched = dmon_watch(dir,watch_cb, DMON_WATCHFLAGS_RECURSIVE, NULL);
|
||||
watched = dmon_watch(".", watch_cb, DMON_WATCHFLAGS_RECURSIVE, NULL);
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
@@ -90,6 +89,7 @@ JSValue js_dmon_unwatch(JSContext *js, JSValue self, int argc, JSValue *argv)
|
||||
JSValue js_dmon_poll(JSContext *js, JSValueConst this_val, int argc, JSValueConst *argv) {
|
||||
FileEvent event;
|
||||
while (dequeue_event(&event)) {
|
||||
if (!JS_IsFunction(js, argv[0])) continue;
|
||||
JSValue jsevent = JS_NewObject(js);
|
||||
JSValue action;
|
||||
switch(event.action) {
|
||||
@@ -116,7 +116,7 @@ JSValue js_dmon_poll(JSContext *js, JSValueConst this_val, int argc, JSValueCons
|
||||
}
|
||||
|
||||
static const JSCFunctionListEntry js_dmon_funcs[] = {
|
||||
JS_CFUNC_DEF("watch", 1, js_dmon_watch),
|
||||
JS_CFUNC_DEF("watch", 0, js_dmon_watch),
|
||||
JS_CFUNC_DEF("unwatch", 0, js_dmon_unwatch),
|
||||
JS_CFUNC_DEF("poll", 1, js_dmon_poll)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user