未处理的承诺拒绝ReferenceError:未定义文档

时间:2020-05-12 11:14:13

标签: react-native chat agora.io

我试图在我的react-native项目中实现agora-rtm-sdk,但是一旦我登录agora,我就得到了这个文档未定义的问题。 问题出在agora-rtm-sdk的index.js文件中。创建实例或登录时,我看不到他们要求任何文档参数。

步骤:

  1. npm install agora-rtm-sdk --save
  2. 从'agora-rtm-sdk'导入AgoraRTM
  3. 创建了Agora的实例
  4. 使用随机uid登录。

enter image description here

var RawStdEncoding = StdEncoding.WithPadding(NoPadding)

1 个答案:

答案 0 :(得分:0)

package main import ( "fmt" "github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/disk" "github.com/shirou/gopsutil/host" "github.com/shirou/gopsutil/mem" ) // SysInfo saves the basic system information type SysInfo struct { Hostname string `bson:hostname` Platform string `bson:platform` CPU string `bson:cpu` RAM uint64 `bson:ram` Disk uint64 `bson:disk` } func main() { hostStat, _ := host.Info() cpuStat, _ := cpu.Info() vmStat, _ := mem.VirtualMemory() diskStat, _ := disk.Usage("\\") // If you're in Unix change this "\\" for "/" info := new(SysInfo) info.Hostname = hostStat.Hostname info.Platform = hostStat.Platform info.CPU = cpuStat[0].ModelName info.RAM = vmStat.Total / 1024 / 1024 info.Disk = diskStat.Total / 1024 / 1024 fmt.Printf("%+v\n", info) } 不能在React Native环境中使用。它旨在用于网站。因此,它将查找DOM的文档对象。

我建议您看看https://github.com/AgoraIO/agora-react-native-rtm

这具有用于React Native的Agora RTM实现。