简体   繁体   English

你如何从 node_modules 调用函数

[英]How do you call functions from node_modules

I'm creating a ReactJS app and I'm using an npm package ( https://www.npmjs.com/package/react-video-recorder ) The package allows you to customize the UI, etc. as stated in the ReadMe ( https://github.com/fbaiodias/react-video-recorder ). I'm creating a ReactJS app and I'm using an npm package ( https://www.npmjs.com/package/react-video-recorder ) The package allows you to customize the UI, etc. as stated in the ReadMe ( https://github.com/fbaiodias/react-video-recorder )。

Within the node_modules package, there are functions like onStartRecording, onStopRecording, etc. If I use the default button that comes with the package, it can call onStartRecording, onStopRecording with no problems.在node_modules package里面,有onStartRecording,onStopRecording等功能。如果我使用package自带的默认按钮,它可以调用onStartRecording,onStopRecording没有问题。

When I create my own record and stop buttons I have no clue how to get access to onStartRecording and onStopRecording.当我创建自己的记录和停止按钮时,我不知道如何访问 onStartRecording 和 onStopRecording。 I would really like to use my own custom buttons because there is more that I want to do when I start or stop recording.我真的很想使用我自己的自定义按钮,因为当我开始或停止录制时我想做更多的事情。

Here's a link to all the functions and actions from the npm package ( https://github.com/fbaiodias/react-video-recorder/blob/master/src/defaults/render-actions.js )这是 npm package ( https://github.com/fbaiodias/react-video-recorder ) 中所有功能和操作的链接

Any help pointing me in the right direction would be extremely helpful.任何指向我正确方向的帮助都会非常有帮助。 Thanks谢谢

you can have a base component for record library component and then have your custom button to import that base component and add more stuff to it.您可以为记录库组件创建一个基本组件,然后使用自定义按钮导入该基本组件并向其添加更多内容。

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

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