我正在使用Phonegap开发我的应用程序,所以我需要将CSS,JS,JS库,index.html打包到assets/www文件夹,以及
super.loadUrl("file:///android_asset/www/index.html",4000);
Run Code Online (Sandbox Code Playgroud)
但有没有办法更新我的CSS,JS,JS库,index.html而不更新我的应用程序(不是从商店或我们自己的服务器更新apk文件) - 这是因为我需要与本机和它(CSS/JS,index.html)可能需要更改.
声音愚蠢,但是有没有办法满足这个要求,iOS解决方案怎么样?
我从中读到:无法使用File API修改/ android_assets/www中的文件,无法从资产中获取文件对象
但是,我发现 资产中的副本文件为sdcard.
那么,我能以某种方式更新资产文件吗?或者这种愚蠢的方式(我不知道iOS解决方案):
1将其复制到sdcard
2更新css/js/index.html 3 super.loadUrl("/ mnt/sdcard/myapp/index.html",4000);
还有其他解决方案,THX?
假设我有3个node.js项目(1个应用后端,1个应用管理员后端,1个分析api)。在每个项目中,我都有一个模型架构调用贷款。
{
attributes: {
userId: { type: String, required: true, index: true, ref: 'users', comment: '??id' },
amount: { type: Number, required: true, min: 0},
totalAmount: { type: Number, required: true, min: 0},
penaltyInterest: { type: Number, min: 0, required: true, default:
0 }
}
methods: {
getFee () {//some calculation ops
}
save() {//some db ops
}
sendTo3rdComponent() {//some network ops
}
}
Run Code Online (Sandbox Code Playgroud)
该模型具有:一些方法,它是模式设计,api实现。如何在其他两个项目中重复使用它。
对于多个项目重用设计和api是非常重要的。
通常,我们通过将其作为npm包公开来重用该组件。但是,此组件具有自己的数据库操作和网络操作。是否可以将其作为npm软件包?
另一种选择是像eggjs
那么,复制粘贴旁边的优雅解决方案是什么?