Skip to content

Conversation

saghul
Copy link
Contributor

@saghul saghul commented Mar 23, 2024

Example usage:

JSValue global = JS_GetGlobalObject(ctx);
JSValue sym = JS_NewSymbol(ctx, "my.secret.thing", TRUE); JSAtom atom = JS_ValueToAtom(ctx, sym);
JS_DefinePropertyValue(ctx, global, atom, JS_NewString(ctx, "qjs!"), JS_PROP_C_W_E); JS_FreeAtom(ctx, atom);
JS_FreeValue(ctx, sym);
JS_FreeValue(ctx, global);

Example usage:

~~~
JSValue global = JS_GetGlobalObject(ctx);
JSValue sym = JS_NewSymbol(ctx, "my.secret.thing", TRUE);
JSAtom atom = JS_ValueToAtom(ctx, sym);
JS_DefinePropertyValue(ctx, global, atom, JS_NewString(ctx, "qjs!"), JS_PROP_C_W_E);
JS_FreeAtom(ctx, atom);
JS_FreeValue(ctx, sym);
JS_FreeValue(ctx, global);
~~~
@saghul saghul merged commit 4a66289 into master Mar 24, 2024
@saghul saghul deleted the new-symbol branch March 24, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants