diff --git a/website/guide/duktapebuiltins.html b/website/guide/duktapebuiltins.html index 8d21c85c..724794f9 100644 --- a/website/guide/duktapebuiltins.html +++ b/website/guide/duktapebuiltins.html @@ -12,20 +12,25 @@ values.

-DuktapeThe Duktape built-in object. Contains miscellaneous implementation specific stuff. -ProxyProxy constructor borrowed from ES6 draft (not part of Ecmascript E5/E5.1). -requireNon-standard, CommonsJS module loading function. -printNon-standard, browser-like function for writing to stdout. -alertNon-standard, browser-like function for writing to stderr. +Duktape + The Duktape built-in object. Contains miscellaneous implementation specific stuff. +Proxy + Proxy constructor borrowed from ES6 draft (not part of Ecmascript E5/E5.1). +require + Non-standard, CommonsJS module loading function. +print + Non-standard, browser-like function for writing to stdout. +alert + Non-standard, browser-like function for writing to stderr. -

require()

+

require()

CommonJS module loading function, see Modules.

-

print() and alert()

+

print() and alert()

print() writes to stdout with an automatic flush afterwards. The bytes written depend on the arguments:

@@ -47,7 +52,7 @@ flush afterwards. The bytes written depend on the arguments:

stderr. Unlike a browser alert(), the call does not block.

-

The Duktape object

+

The Duktape object

@@ -56,27 +61,44 @@ does not block.

- - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
versionDuktape version number: (major * 10000) + (minor * 100) + patch.
envCryptic, version dependent summary of most important effective options like endianness and architecture.
finSet or get finalizer of an object.
encEncode a value (hex, base-64, JX, JC): Duktape.enc('hex', 'foo').
decDecode a value (hex, base-64, JX, JC): Duktape.dec('base64', 'Zm9v').
infoGet internal information (such as heap address and alloc size) of a value in a version specific format.
actGet information about call stack entry.
gcTrigger mark-and-sweep garbage collection.
compactCompact the memory allocated for a value (object).
errCreateCallback to modify/replace a created error.
errThrowCallback to modify/replace an error about to be thrown.
modSearchModule search function, must be provided by user code if using modules.
modLoadedInternal tracking table for loaded modules, maps resolved identifier to exported symbols.
BufferBuffer constructor (function).
PointerPointer constructor (function).
ThreadThread constructor (function).
LoggerLogger constructor (function).
versionDuktape version number: (major * 10000) + (minor * 100) + patch.
envCryptic, version dependent summary of most important effective options like endianness and architecture.
finSet or get finalizer of an object.
encEncode a value (hex, base-64, JX, JC): Duktape.enc('hex', 'foo').
decDecode a value (hex, base-64, JX, JC): Duktape.dec('base64', 'Zm9v').
infoGet internal information (such as heap address and alloc size) of a value in a version specific format.
actGet information about call stack entry.
gcTrigger mark-and-sweep garbage collection.
compactCompact the memory allocated for a value (object).
errCreateCallback to modify/replace a created error.
errThrowCallback to modify/replace an error about to be thrown.
modSearchModule search function, must be provided by user code if using modules.
modLoadedInternal tracking table for loaded modules, maps resolved identifier to exported symbols.
BufferBuffer constructor (function).
PointerPointer constructor (function).
ThreadThread constructor (function).
LoggerLogger constructor (function).
-

version

+

version

The version property allows version-based feature detection and behavior. Version numbers can be compared directly: a logically higher version @@ -117,7 +139,7 @@ if (typeof Duktape !== 'object') { } -

env

+

env

env summarizes the most important effective compile options in a version specific, quite cryptic manner. The format is version specific @@ -135,7 +157,7 @@ ll u p2 a4 x64 linux gcc // l|b|m integer endianness, l|b|m IEEE double endi // gcc|clang|msvc|etc: compiler -

fin()

+

fin()

When called with a single argument, gets the current finalizer of an object:

@@ -148,7 +170,7 @@ Duktape.fin(o, function(x) { print('finalizer called'); });
 Duktape.fin(o, undefined);  // disable
 
-

enc()

+

enc()

enc() encodes its argument value into chosen format. The first argument is a format (currently supported are "hex", "base64", @@ -172,7 +194,7 @@ var result = Duktape.enc('jx', { foo: 123 }, null, 4); print(result); // prints JX encoded {foo:123} with 4-space indent -

dec()

+

dec()

dec() provides the reverse function of enc().

@@ -196,7 +218,7 @@ var result = Duktape.dec('jx', "{foo:123}"); print(result.foo); // prints 123 -

info()

+

info()

When given an arbitrary input value, Duktape.info() returns an array of values with internal information related to the value. The format of @@ -393,7 +415,7 @@ debugging and diagnosis, e.g. when estimating rough memory usage of objects.

-

act()

+

act()

Get information about a call stack entry. Takes a single number argument indicating depth in the call stack: -1 is the top entry, -2 is the one below @@ -443,7 +465,7 @@ print('running on line:', getCurrentLine()); The properties provided for call stack entries may change between versions. -

gc()

+

gc()

Trigger a forced mark-and-sweep collection. If mark-and-sweep is disabled, this call is a no-op.

@@ -452,7 +474,7 @@ this call is a no-op.

Not sure what the best return value would be. --> -

compact()

+

compact()

Minimize the memory allocated for a target object. Same as the C API call duk_compact() but accessible from Ecmascript code. If called with @@ -467,7 +489,7 @@ var obj = {

This call is useful when you know that an object is unlikely to gain new properties, but you don't want to seal or freeze the object in case it does.

-

errCreate() and errThrow()

+

errCreate() and errThrow()

These can be set by user code to process/replace errors when they are created (errCreate) or thrown (errThrow). Both values are @@ -477,7 +499,7 @@ initially non-existent.

Error handlers (errCreate and errThrow) for details.

-

modSearch() and modLoaded

+

modSearch() and modLoaded

modSearch() is a module search function which must be provided by user code to support module loading. @@ -488,7 +510,7 @@ or currently being loaded.

See Modules for details.

-

Duktape.Buffer (constructor)

+

Duktape.Buffer (constructor)

@@ -556,7 +578,7 @@ var plain_buf = Duktape.Buffer('test'); print(plain_buf.toString()); -

Duktape.Pointer (constructor)

+

Duktape.Pointer (constructor)

@@ -603,7 +625,7 @@ var plain_ptr = Duktape.Pointer({ test: 'object' }); print(plain_ptr.toString()); -

Duktape.Thread (constructor)

+

Duktape.Thread (constructor)

@@ -645,7 +667,7 @@ cases:

-

Duktape.Logger (constructor)

+

Duktape.Logger (constructor)