mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-26 07:22:21 +00:00
Add RTrace typings and include it in the package (#636)
This commit is contained in:
parent
4680b530fb
commit
420812f5b2
82
lib/rtrace/index.d.ts
vendored
Normal file
82
lib/rtrace/index.d.ts
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* This method returns an `RTrace` object used for reference count tracing.
|
||||
*
|
||||
* @param {TraceEventCallback?} onerror - A method that is called when a trace error event occurs.
|
||||
* @param {TraceEventCallback?} oninfo - A method that is called when a trace info event occurs.
|
||||
*/
|
||||
declare function rtrace(onerror?: rtrace.TraceEventCallback, oninfo?: rtrace.TraceEventCallback): rtrace.RTrace;
|
||||
|
||||
declare namespace rtrace {
|
||||
/**
|
||||
* The RTrace interface represents a collection of properties that help develoeprs describe the
|
||||
* reference counts and state of the Web Assembly module.
|
||||
*/
|
||||
export interface RTrace {
|
||||
|
||||
/**
|
||||
* The current allocation count.
|
||||
*/
|
||||
allocCount: number;
|
||||
|
||||
/**
|
||||
* The current free count.
|
||||
*/
|
||||
freeCount: number;
|
||||
|
||||
/**
|
||||
* The current increment count.
|
||||
*/
|
||||
incrementCount: number;
|
||||
|
||||
/**
|
||||
* The current decrement count.
|
||||
*/
|
||||
decrementCount: number;
|
||||
|
||||
/**
|
||||
* This method is called when an allocation occurs.
|
||||
*
|
||||
* @param {number} block - The `ptr - 16` value indicating the start of the block.
|
||||
*/
|
||||
onalloc(block: number): void;
|
||||
|
||||
/**
|
||||
* This method is called when a block is freed.
|
||||
*
|
||||
* @param {number} block - The `ptr - 16` value indicating the start of the block.
|
||||
*/
|
||||
onfree(block: number): void;
|
||||
|
||||
/**
|
||||
* This method is called when a reference count is incrememnted
|
||||
*
|
||||
* @param {number} block - The `ptr - 16` value indicating the start of the block.
|
||||
*/
|
||||
onincrement(block: number): void;
|
||||
|
||||
/**
|
||||
* This method is called when a reference count is decremented.
|
||||
*
|
||||
* @param {number} block - The `ptr - 16` value indicating the start of the block.
|
||||
*/
|
||||
ondecrement(block: number): void;
|
||||
|
||||
/**
|
||||
* This property indicates if rtrace is active.
|
||||
*/
|
||||
readonly active: boolean;
|
||||
|
||||
/**
|
||||
* This method returns the current number of allocated blocks.
|
||||
*/
|
||||
check(): number;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a trace event callback. It accepts a string containing a message about the event.
|
||||
*/
|
||||
export type TraceEventCallback = (info: string) => void;
|
||||
}
|
||||
|
||||
export = rtrace;
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "@assemblyscript/rtrace",
|
||||
"types": "index.d.ts",
|
||||
"version": "0.1.0",
|
||||
"license": "Apache-2.0",
|
||||
"main": "index.js"
|
||||
|
@ -56,6 +56,10 @@
|
||||
"postinstall": "opencollective-postinstall || exit 0"
|
||||
},
|
||||
"files": [
|
||||
"lib/rtrace/index.d.ts",
|
||||
"lib/rtrace/index.js",
|
||||
"lib/rtrace/README.md",
|
||||
"lib/rtrace/package.json",
|
||||
"lib/loader/index.d.ts",
|
||||
"lib/loader/index.js",
|
||||
"lib/loader/README.md",
|
||||
|
Loading…
x
Reference in New Issue
Block a user