https://github.com/nativescript/sample-native-module
Sample native module for NativeScript
https://github.com/nativescript/sample-native-module
Last synced: about 1 month ago
JSON representation
Sample native module for NativeScript
- Host: GitHub
- URL: https://github.com/nativescript/sample-native-module
- Owner: NativeScript
- Created: 2015-12-01T09:21:59.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-07-09T07:49:29.000Z (over 6 years ago)
- Last Synced: 2024-10-29T15:51:51.762Z (about 1 year ago)
- Language: C++
- Homepage:
- Size: 116 MB
- Stars: 11
- Watchers: 27
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sample-native-module
This repo contains example of NativeScript native module. Regular {N} modules are created in JavaScript and you consume it as follows:
```JavaScript
var myModule = require('./myModule.js');
```
NativeScript native modules are similar to [Node.js addons](https://nodejs.org/api/addons.html). Native modules provide glue to C and C++ libraries. They are consumed as regular JavaScript modules.
```JavaScript
var myModule = require('./libCalc.so');
```
Because native modules are architecture specific (e.g. ARM, x86, etc.) it is good practice to convey them with regular JavaScript ones that hide the details.
Native modules are useful in performance sensitive scenarios because they avoid JavaScript-to-Java marshalling. Good examples are OpenGL libraries.
You can see Android implementation [here](https://github.com/NativeScript/sample-native-module/tree/master/Android).