NativeScript / ios

NativeScript for iOS and visionOS using V8
https://docs.nativescript.org/guide/ios-marshalling
131 stars 33 forks source link

feat: use node logic for globals and modules #215

Closed edusperoni closed 1 year ago

edusperoni commented 1 year ago

Draft on how new modules and globals could work

Instead of calling Init manually on the runtime, each module would register itself either as a global (NODE_BINDING_PER_ISOLATE_INIT_OBJ) or as a node module (NODE_BINDING_CONTEXT_AWARE_INTERNAL).

Globals are already working, we still need work for the node modules (essentially check if a module is a native module and call it + cache it).

This will allow us to require('ns:crypto'), for example. In the future, we could even rework the way we use native libraries so you can do: import { NSString } from 'ns:native:Foundation' to get a slimmer app size and automatic metadata filtering through bundlers

https://github.com/NativeScript/NativeScript/issues/195