Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
emscripten-library-decorator
Advanced tools
This package provides decorators for writing Emscripten libraries.
function _print(message: string) {
console.log(message);
}
@exportLibrary
class test {
@dep(_print)
static hello() {
_print('Hello, World!!');
}
static foobar = 42;
};
The class decorator @exportLibrary
exports the static members of the class as an Emscripten library. Place it with no arguments just before the class.
The property decorator @dep
is for listing dependencies. It ensures that when an exported function is used in the C or C++ code, other required functions are also included in the compiled Emscripten output after dead code elimination. Place it just before a function with any number of parameters listing the other required functions.
The dependencies should be global functions and their name should begin with an underscore. Otherwise Emscripten's name mangling will change their name in the output making any calls to them fail.
There is a longer article with more information.
Docs generated using docts
Function
defineHidden
@_defineHidden decorator.
Assign to a local variable called _defineHidden before using.
Apply to a property to protect it from modifications and hide it.
Source code:<>
defineHidden( ) ⇒
(target: Object, key: string) => void
<>
▫ value?any
Function
dep
@dep decorator.
Apply to a function, to list other required variables needing protection
from dead code removal.
Arguments can be functions or names of global variables.
Source code:<>
dep( ) ⇒
(target: Object, functionName: string) => void
<>
▪ depList((...args: any[]) => any | string)[]
Function
exportLibrary
@exportLibrary decorator.
Apply to a class with static methods, to export them as functions.
Source code:<>
exportLibrary( ) ⇒
void
<>
▪ targetany
Function
prepareNamespace
@prepareNamespace decorator.
Apply to an empty, named dummy class defined at the end of the namespace
block, to prepare its contents for export in an Emscripten library.
Namespaces with matching names in different files are merged together.
All code in the block is separated because Emscripten only outputs global
functions, not methods.
Source code:<>
prepareNamespace( ) ⇒
(target: any) => void
<>
▪ namestring
Function
publishNamespace
Call once per namespace at the global level, after all files with contents
in that namespace have been imported. Clears the namespace and exports a
"postset" function to populate it using its original code.
Source code:<>
publishNamespace( ) ⇒
void
<>
▪ namestring
Function
setEvil
Allow decorators to call eval() in the context that called them.
This is needed for various transformations.
Source code:<>
setEvil( ) ⇒
void
<>
▪ otherEval(code: string) => any
must be this function: (code: string) => eval(code)
Copyright (c) 2015-2016 BusFaster Ltd
FAQs
Decorators for writing Emscripten libraries
The npm package emscripten-library-decorator receives a total of 57 weekly downloads. As such, emscripten-library-decorator popularity was classified as not popular.
We found that emscripten-library-decorator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.