Skip to content

Commit 30b32a9

Browse files
doc: apply mobile documentation
1 parent 54e0552 commit 30b32a9

12 files changed

+720
-697
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
<!--
22
Thank you for reporting an issue.
33
4-
This issue tracker is for bugs and issues found within Node.js core.
5-
If you require more general support please file an issue on our help
6-
repo. https://github.com/nodejs/help
4+
This issue tracker is only for reporting bugs and issues found in the nodejs-mobile core library, the nodejs-mobile-cordova plugin or the nodejs-mobile-react-native plugin.
75
6+
If you are not trying to report a bug or an issue, but rather have a question or are seeking general support, please use the Resources for Newcomers instead:
7+
https://github.com/janeasystems/nodejs-mobile#resources-for-newcomers
88
9-
Please fill in as much of the template below as you're able.
9+
Please fill in as much of the template below as you can.
1010
11-
Version: output of `node -v`
12-
Platform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)
13-
Subsystem: if known, please specify affected core module name
11+
Project: nodejs-mobile, nodejs-mobile-cordova or nodejs-mobile-react-native
12+
Version: the version of the library or plugin you are using
13+
Mobile device: the device manufacturer and model or the simulator/emulator used
14+
Mobile OS and version: Android or iOS version
15+
Development Node.js: output of `node -v` on the machine used to build the application
16+
Development platform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)
1417
15-
If possible, please provide code that demonstrates the problem, keeping it as
16-
simple and free of external dependencies as you are able.
18+
If possible, please provide code that demonstrates the problem, keeping it as simple and free of external dependencies as possible. Cloning and adapting one of the samples to show the issue is a simple way to achieve this:
19+
https://github.com/janeasystems/nodejs-mobile-samples/
1720
-->
1821

22+
* **Project**:
1923
* **Version**:
20-
* **Platform**:
21-
* **Subsystem**:
24+
* **Mobile device**:
25+
* **Mobile OS and version**:
26+
* **Development Node.js**:
27+
* **Development platform**:
2228

2329
<!-- Enter your issue details below this comment. -->

.github/ISSUE_TEMPLATE/1-bug-report.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/2-feature-request.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,3 @@ Contributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md
1414
- [ ] tests and/or benchmarks are included
1515
- [ ] documentation is changed or added
1616
- [ ] commit message follows [commit guidelines](https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines)
17-
18-
<!--
19-
Developer's Certificate of Origin 1.1
20-
21-
By making a contribution to this project, I certify that:
22-
23-
(a) The contribution was created in whole or in part by me and I
24-
have the right to submit it under the open source license
25-
indicated in the file; or
26-
27-
(b) The contribution is based upon previous work that, to the best
28-
of my knowledge, is covered under an appropriate open source
29-
license and I have the right under that license to submit that
30-
work with modifications, whether created in whole or in part
31-
by me, under the same open source license (unless I am
32-
permitted to submit under a different license), as indicated
33-
in the file; or
34-
35-
(c) The contribution was provided directly to me by some other
36-
person who certified (a), (b) or (c) and I have not modified
37-
it.
38-
39-
(d) I understand and agree that this project and the contribution
40-
are public and that a record of the contribution (including all
41-
personal information I submit with it, including my sign-off) is
42-
maintained indefinitely and may be redistributed consistent with
43-
this project or the open source license(s) involved.
44-
-->

.github/SUPPORT.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

FAQ.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Frequently Asked Questions
2+
3+
- [Can I use npm node-modules with nodejs-mobile?](#can-i-use-npm-node-modules-with-nodejs-mobile)
4+
- [Are all Node.js APIs supported on mobile?](#are-all-nodejs-apis-supported-on-mobile)
5+
- [Trying to write a file results in an error. What's going on?](#trying-to-write-a-file-results-in-an-error-whats-going-on)
6+
- [Are Node.js native modules supported?](#are-nodejs-native-modules-supported)
7+
- [How can I improve Node.js load times?](#how-can-i-improve-nodejs-load-times)
8+
- [Can I run two or more Node.js instances?](#can-i-run-two-or-more-nodejs-instances)
9+
- [Can I run Node.js code in a WebView?](#can-i-run-nodejs-code-in-a-webview)
10+
- [Can you support a plugin for the X mobile framework?](#can-you-support-a-plugin-for-the-x-mobile-framework)
11+
12+
## Can I use npm node-modules with nodejs-mobile?
13+
14+
npm modules can be used with nodejs-mobile. They need to be installed at development time in the application source folder that contains the Node.js project files. There are samples that show how to use npm modules for [Android](https://github.com/janeasystems/nodejs-mobile-samples/tree/master/android/native-gradle-node-folder) and [iOS](https://github.com/janeasystems/nodejs-mobile-samples/tree/master/ios/native-xcode-node-folder) when using the native library directly. There are instructions in the [nodejs-mobile-cordova](https://github.com/janeasystems/nodejs-mobile-cordova#node-modules) and [nodejs-mobile-react-native](https://github.com/janeasystems/nodejs-mobile-react-native#node-modules) plugins README on how to use them.
15+
16+
## Are all Node.js APIs supported on mobile?
17+
18+
Not every API is supported on mobile, the main reason for this being that the mobile operating systems won't allow applications to call certain APIs that are expected to be available on other operating systems. Examples:
19+
- APIs that create new processes, such as `child_process.spawn()` or `child_process.fork()` will run into permission issues.
20+
- Using `process.exit()` is not allowed by the Apple App Store guildelines.
21+
- `os.cpus()` may return inconsistent/unreliable results, since different OS versions will have different permissions for accessing CPU information.
22+
23+
## Trying to write a file results in an error. What's going on?
24+
25+
Mobile platforms are different than the usual desktop platforms in that they require applications to write in specific sandboxed paths and don't have permissions to write elsewhere. You should pass an appropriate writable path for your use case to the Node.js runtime and write there. An API call to return the path most regularly used for data in each platform has been added to the [nodejs-mobile-cordova](https://github.com/janeasystems/nodejs-mobile-cordova#cordovaappdatadir) and [nodejs-mobile-react-native](https://github.com/janeasystems/nodejs-mobile-react-native#rn_bridgeappdatadir) plugins.
26+
27+
## Are Node.js native modules supported?
28+
29+
Node native modules, which contain native code, are able to run on nodejs-mobile, as long as they can be cross-compiled for the target platform / CPU. The cross-compiling feature is integrated into the plugins and instructions can be found in the [nodejs-mobile-cordova](https://github.com/janeasystems/nodejs-mobile-cordova#native-modules) or in the [nodejs-mobile-react-native](https://github.com/janeasystems/nodejs-mobile-react-native#native-modules) README, but only Linux and MacOS development machines are currently supported. Modules that contain custom build steps and platform specific code may need workarounds/changes to get them to work. We've created a github repository so that the workarounds/changes can be discussed and shared: https://github.com/janeasystems/nodejs-mobile-module-compat
30+
31+
## How can I improve Node.js load times?
32+
33+
Applications that contain a large number of files in the Node.js project can have their load times decreased by reducing the number of files. While installing npm modules, these can be installed with the `--production` flag, so that modules that are used for development only are not included in your project, e.g.: `npm install --production <module_name>`. Using tools that merge all nodejs project files into a bundle, such as [`noderify`](https://www.npmjs.com/package/noderify) and using the bundle instead has been observed to improve load times in most situations.
34+
35+
## Can I run two or more Node.js instances?
36+
37+
No. The runtime expects to be run as a single instance in the process. In practice this should not preclude any usage scenarios, given node's asynchronous nature. Multiple sub-tasks can be executed by simply loading all the corresponding modules with `require` from a main script.
38+
39+
## Can I run Node.js code in a WebView?
40+
41+
No. Node.js uses a libuv event loop at its core, which is different than the event loop in the WebView. Having the node runtime run in its own thread also prevents Node.js tasks for interfering with the UI, which might cause responsiveness issues.
42+
The supported usage scenario is that nodejs-mobile runs in a background thread and the UI (in this case a WebView) must use a communication mechanism to send/receive data from Node.js.
43+
This technique is used in the `nodejs-mobile-cordova` plugin, where Cordova uses a dedicated thread to run Node.js alongside the WebView.
44+
45+
## Can you support a plugin for the X mobile framework?
46+
47+
We are currently focused on supporting cordova and react-native plugins only, but we are open to community contributions for other frameworks.
48+
If you are interested in a particular framework, please see if [an issue](https://github.com/janeasystems/nodejs-mobile/issues/) for it has already been opened, and let us know about your interest in there. Otherwise, feel free to open a new issue.
49+

0 commit comments

Comments
 (0)