所以我使用这个名为Janus的库,它是janus-gateway的javascript,我如何在我的项目中使用它?
迄今已尝试过:
2 var $ = require('jquery');
3 var Janus = require('../../vendor/janus');Janus是jquery的依赖者。Jquery似乎有效,但Janus却不行。用于janus.js的pastebin:http://pastebin.com/MdUxTbDU
我用的是Angular2和打字本。
产生的错误:
jQuery.Deferred exception: Janus.init is not a function TypeError: Janus.init is not a function
at HTMLDocument.<anonymous> (http://localhost:3000/main.bundle.js:372:20)
at mightThrow (http://localhost:3000/vendor.bundle.js:47178:30)
at process (http://localhost:3000/vendor.bundle.js:47246:13)
at ZoneDelegate.invokeTask (http://localhost:3000/polyfills.bundle.js:14544:38)
at Zone.runTask (http://localhost:3000/polyfills.bundle.js:14444:48)
at ZoneTask.invoke (http://localhost:3000/polyfills.bundle.js:14612:34) undefined
zone.js:140 Uncaught TypeError: Janus.init is not a function发布于 2016-10-13 15:59:30
只需将库的JavaScript文件包括在index.html文件和角2组件中,使用下面的语句在顶部声明它。
declare var Janus: any;
然后开始在组件中使用Janus.[anything]。
你可以像这样使用任何第三方库。
https://stackoverflow.com/questions/40025703
复制相似问题