Biting the bullet: exposing the JS window object to Lua
- Added a convenience function for creating HTML widgets, streamlining widget creation. - Enhanced the key retrieval logic in the pairs function to ensure it captures prototype keys correctly. - Exposed the global window object in the jsApi for better access to DOM functions.
This commit is contained in:
@@ -69,17 +69,6 @@ export const jsApi = new LuaTable({
|
||||
*/
|
||||
stringify: new LuaBuiltinFunction((_sf, val) => JSON.stringify(val)),
|
||||
|
||||
// Exposing DOM functions
|
||||
createElement: new LuaBuiltinFunction((_sf, tag) =>
|
||||
document.createElement(tag)
|
||||
),
|
||||
createTextNode: new LuaBuiltinFunction((_sf, text) =>
|
||||
document.createTextNode(text)
|
||||
),
|
||||
Blob: new LuaNativeJSFunction((
|
||||
blobParts: any[],
|
||||
options: BlobPropertyBag,
|
||||
) => {
|
||||
return new Blob(blobParts, options);
|
||||
}),
|
||||
// Expose the global window object
|
||||
window: window,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user