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 fpses = []
|
||||||
var timescale = 1
|
var timescale = 1
|
||||||
|
|
||||||
|
var dmon = use('dmon')
|
||||||
|
|
||||||
function step() {
|
function step() {
|
||||||
|
if (dmon)
|
||||||
|
dmon.poll(prosperon.dmon)
|
||||||
|
|
||||||
var now = os.now()
|
var now = os.now()
|
||||||
var dt = now - last_frame_time
|
var dt = now - last_frame_time
|
||||||
if (dt < waittime) os.sleep(waittime - dt)
|
if (dt < waittime) os.sleep(waittime - dt)
|
||||||
|
|||||||
@@ -417,11 +417,6 @@ static BufferCheckResult get_or_extend_buffer(
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(_WIN32) || defined(__WIN32__))
|
|
||||||
#include <direct.h>
|
|
||||||
#define mkdir(x,y) _mkdir(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct lrtb {
|
struct lrtb {
|
||||||
float l;
|
float l;
|
||||||
float r;
|
float r;
|
||||||
|
|||||||
@@ -71,9 +71,8 @@ JSValue js_dmon_watch(JSContext *js, JSValue self, int argc, JSValue *argv)
|
|||||||
{
|
{
|
||||||
if (watched.id)
|
if (watched.id)
|
||||||
return JS_ThrowReferenceError(js, "Already watching a directory.");
|
return JS_ThrowReferenceError(js, "Already watching a directory.");
|
||||||
|
|
||||||
const char *dir = JS_ToCString(js,argv[0]);
|
watched = dmon_watch(".", watch_cb, DMON_WATCHFLAGS_RECURSIVE, NULL);
|
||||||
watched = dmon_watch(dir,watch_cb, DMON_WATCHFLAGS_RECURSIVE, NULL);
|
|
||||||
return JS_UNDEFINED;
|
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) {
|
JSValue js_dmon_poll(JSContext *js, JSValueConst this_val, int argc, JSValueConst *argv) {
|
||||||
FileEvent event;
|
FileEvent event;
|
||||||
while (dequeue_event(&event)) {
|
while (dequeue_event(&event)) {
|
||||||
|
if (!JS_IsFunction(js, argv[0])) continue;
|
||||||
JSValue jsevent = JS_NewObject(js);
|
JSValue jsevent = JS_NewObject(js);
|
||||||
JSValue action;
|
JSValue action;
|
||||||
switch(event.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[] = {
|
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("unwatch", 0, js_dmon_unwatch),
|
||||||
JS_CFUNC_DEF("poll", 1, js_dmon_poll)
|
JS_CFUNC_DEF("poll", 1, js_dmon_poll)
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user