Skip to content
Snippets Groups Projects
Commit d2f42df7 authored by rswindell's avatar rswindell
Browse files

Added mswait and beep functions (methods).

parent 3de28878
Branches
Tags
No related merge requests found
......@@ -112,6 +112,34 @@ js_format(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return JS_TRUE;
}
static JSBool
js_mswait(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
int val=1;
if(argc)
val=JSVAL_TO_INT(argv[0]);
mswait(val);
return(JS_TRUE);
}
static JSBool
js_beep(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
int freq=500;
int dur=500;
if(argc)
freq=JSVAL_TO_INT(argv[0]);
if(argc>1)
dur=JSVAL_TO_INT(argv[1]);
sbbs_beep(freq,dur);
return(JS_TRUE);
}
static JSClass js_global_class ={
"Global",
JSCLASS_HAS_PRIVATE, /* needed for scfg_t ptr */
......@@ -122,6 +150,8 @@ static JSClass js_global_class ={
static JSFunctionSpec js_global_functions[] = {
{"load", js_load, 1}, /* Load and execute a javascript file */
{"format", js_format, 1}, /* return a formatted string (ala printf) */
{"mswait", js_mswait, 0}, /* millisecond wait/sleep routine */
{"beep", js_beep, 0}, /* local beep (freq, dur) */
{0}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment