简体   繁体   English

如何在JS文件中导入API /外部JS?

[英]How to import API/external JS in a JS file?

I'm coding a web extension for Firefox and I would like to make the same thing as this: https://stackoverflow.com/a/32616807/10452863 , which means use Google API to search random images. 我正在为Firefox编写一个Web扩展,并且我想做与此相同的事情: https : //stackoverflow.com/a/32616807/10452863 ,这意味着使用Google API搜索随机图像。

How can I import the Google API in my .js file ? 如何在.js文件中导入Google API?

if you want to try out any npm package, I would suggest googleapis . 如果您想尝试任何npm软件包,我建议googleapis You can use all Google APIs with this node.js client library. 您可以将所有Google API与该node.js客户端库一起使用。

          To import use ``` const { google } = require("googleapis")```

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM