且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Cordova Visual Studio 中添加 javaScript 库?

更新时间:2023-02-21 09:40:37

看起来这个 javascript 库发布在 NPM 上:

然后,您可以将库文件复制到 www 文件夹并在您的应用中使用它们(希望它们与 Cordova 兼容!).

I have been trying to use the twitter api on cordova visual studio, for this I need to use OAuth for authentication for requests. I would like to use the https://github.com/BoyCook/TwitterJSClient.git twitter client. The built in nuGet package manager does not have this library. How can I install this JS library in my cordova msvs?

I tried using npm on the command line to intall this library but I get this error. What does it mean?

It looks like this javascript library is published on NPM: https://www.npmjs.com/package/twitter-node-client. To add this to your project, open the package.json file and put this in your dependencies section:

"twitter-js-client": "0.0.5"

You'll then see the "Dependencies" node in solution explorer say "(Restoring...)", and soon you'll see a node_modules folder appear in solution explorer. If you don't, turn on "show all files". This is what you should see:

You can then copy the library files into your www folder and consume them in your app (hopefully they work with Cordova!).