npm i --save nativehtml
- 版本:0.0.5
- GitHub:
- NPM: https://npmjs.net.cn/package/nativehtml
- 下载
- 昨天:0
- 上周:0
- 上个月:0
nativeHTML
hyperHTML的便捷性和NativeScript的性能,适用于 Android 和 iOS。
正在进行中
基本设置
有关如何设置系统的官方文档页面。
不过,在 ArchLinux 上,您可以通过这篇文章或键入以下内容进行操作
# install android stuff via archibold, IF NEEDED
bash <(curl -s archibold.io/install/android)
# setup env and read terms and conditions
sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "build-tools;25.0.3" "extras;android;m2repository" "extras;google;m2repository"
# install NativeScript (tsc)
npm install -g nativescript --unsafe-perm
# install virtual device
yaourt -S --needed genymotion
启动后,创建免费开发者账户并在 Genymotion 中选择 自定义手机 — 7.1.0 API 25 作为设备。
查找设备
一旦安装了Android工具并运行了Genymotion,键入以下内容
tns device android --available-devices
您应该会看到设备列表和相关ID。
运行基本示例
从您的开发者文件夹中,我们将创建一个新的 NativeScript Hello World 示例。
tns create ns-hello-world --template tns-template-hello-world
cd ns-hello-world
此时,我们可以首次启动示例。第一次启动可能需要比平时更长的时间,因为它需要安装额外的软件。
# be sure the device id is your correct one
# tns device android --available-devices
tns run android --device 192.168.1.2:3456
# NOTE: if you have one device only
# you can just type tns run android
如果一切顺利,您应该已经看到了一个Hello World应用程序。
测试 nativeHTML
从同一文件夹,即ns-hello-world
,克隆此存储库并复制一些文件。
# install nativehtml
npm install --save nativehtml
# copy the default example page
cp node_modules/nativehtml/examples/default-app.js app/main-page.js
# deploy via tns deploy android
tns deploy android --device 192.168.1.2:3456
# NOTE: you can omit --device xx.xx.xx if only 1 device
# run the debugger
tns debug android --debug-brk
一旦调试器显示Chrome/ium链接,前往那里并运行代码。
您应该会看到app/main-page.js
通过hyperHTML和basicHTML运行。