As of 3 October 2020, DukTerm makes 35 functions and 35 constants available to Javascript (also 4 variables). A couple of helpers handle the details. In fact, you can get away with just:
#include "dukterm.h" // ... duk_context *ctx = duk_create_heap_default(); dukterm_bind_to(ctx);
Look in main.c for a more complete example.
The current version of DukTerm has a couple of quirks:
Also, only string output functions are included in the first version.
initscr(); endwin(); isendwin(); cbreak(); nocbreak(); echo(); noecho(); raw(); noraw(); nl(); nonl(); // Note the changed argument list! keypad(flag); leaveok(flag); scrollok(flag); attron(attr); attroff(attr); attrset(attr); standout(); standend(); color_set(color); has_colors(); start_color(); init_pair(pair, fg, bg); getmaxx(); getmaxy(); erase(); clear(); refresh(); move(y, x); addstr(str); addnstr(str, n); mvaddstr(y, x, str); mvaddnstr(y, x, str, n); getch(); KEY_F(n);
OK ERR A_NORMAL A_STANDOUT A_UNDERLINE A_REVERSE A_BLINK A_DIM A_BOLD A_PROTECT A_INVIS A_ALTCHARSET COLOR_BLACK COLOR_RED COLOR_GREEN COLOR_YELLOW COLOR_BLUE COLOR_MAGENTA COLOR_CYAN COLOR_WHITE KEY_RESIZE KEY_BACKSPACE KEY_ENTER KEY_BREAK KEY_UP KEY_DOWN KEY_LEFT KEY_RIGHT KEY_HOME KEY_END KEY_PPAGE KEY_NPAGE KEY_DC KEY_IC KEY_F0
LINES COLS COLORS COLOR_PAIRS