You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Sami Vaarala 0067588f69 Extras fixes for symbols 8 years ago
..
Makefile Add warning options to extra test makefiles 9 years ago
README.rst print-alert/console extra consistency trivia 9 years ago
duk_console.c Extras fixes for symbols 8 years ago
duk_console.h Add minimal console extra 9 years ago
test.c Minor module-node fixes 9 years ago

README.rst

=========================
Minimal 'console' binding
=========================

Duktape doesn't provide a ``console`` binding (for example ``console.log``)
by default because it would be a portability issue for some targets. Instead,
an application should provide its own ``console`` binding. This directory
contains an example binding:

* Add ``duk_console.c`` to list of C sources to compile.

* Ensure ``duk_console.h`` is in the include path.

* Include the extra header in calling code and initialize the bindings::

#include "duktape.h"
#include "duk_console.h"

/* After initializing the Duktape heap or when creating a new
* thread with a new global environment:
*/
duk_console_init(ctx, 0 /*flags*/);

Use the ``DUK_CONSOLE_PROXY_WRAPPER`` to enable a Proxy wrapper for the
console object. The wrapper allows all undefined methods (for example,
``console.foo``) to be handled as no-ops instead of throwing an error.
See ``duk_console.h`` for full flags list.

* After these steps, ``console`` will be registered to the global object
and is ready to use.