core: Move some simple properties JS => C.
This commit is contained in:
@@ -178,6 +178,7 @@ async function getProcessBlob(blobId, key, options) {
|
|||||||
process.task = new Task();
|
process.task = new Task();
|
||||||
process.packageOwner = options.packageOwner;
|
process.packageOwner = options.packageOwner;
|
||||||
process.packageName = options.packageName;
|
process.packageName = options.packageName;
|
||||||
|
process.url = options?.url;
|
||||||
process.eventHandlers = {};
|
process.eventHandlers = {};
|
||||||
if (!options?.script || options?.script === 'app.js') {
|
if (!options?.script || options?.script === 'app.js') {
|
||||||
process.app = new app.App();
|
process.app = new app.App();
|
||||||
@@ -287,11 +288,6 @@ async function getProcessBlob(blobId, key, options) {
|
|||||||
throw Error(`Permission denied: ${permission}.`);
|
throw Error(`Permission denied: ${permission}.`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
app: {
|
|
||||||
owner: options?.packageOwner,
|
|
||||||
name: options?.packageName,
|
|
||||||
},
|
|
||||||
url: options?.url,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
process.sendIdentities = async function () {
|
process.sendIdentities = async function () {
|
||||||
|
@@ -333,6 +333,14 @@ static JSValue _tf_api_register_imports(JSContext* context, JSValueConst this_va
|
|||||||
JS_SetPropertyStr(context, core, "users", JS_NewCFunctionData(context, _tf_api_core_users, 0, 0, 1, &process));
|
JS_SetPropertyStr(context, core, "users", JS_NewCFunctionData(context, _tf_api_core_users, 0, 0, 1, &process));
|
||||||
|
|
||||||
JS_SetPropertyStr(context, core, "permissionsForUser", JS_NewCFunctionData(context, _tf_api_core_permissionsForUser, 1, 0, 1, &process));
|
JS_SetPropertyStr(context, core, "permissionsForUser", JS_NewCFunctionData(context, _tf_api_core_permissionsForUser, 1, 0, 1, &process));
|
||||||
|
|
||||||
|
JSValue app = JS_NewObject(context);
|
||||||
|
JS_SetPropertyStr(context, app, "owner", JS_GetPropertyStr(context, process, "packageOwner"));
|
||||||
|
JS_SetPropertyStr(context, app, "name", JS_GetPropertyStr(context, process, "packageName"));
|
||||||
|
JS_SetPropertyStr(context, core, "app", app);
|
||||||
|
|
||||||
|
JS_SetPropertyStr(context, core, "url", JS_GetPropertyStr(context, process, "url"));
|
||||||
|
|
||||||
JS_FreeValue(context, core);
|
JS_FreeValue(context, core);
|
||||||
return JS_UNDEFINED;
|
return JS_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user