Skip to content

CatchLabs/leancloud-realtime-typed-messages-without-avoscloud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

leancloud-realtime-typed-messages-without-avoscloud

官方的富媒体消息组件leancloud-realtime-typed-messages 需要依赖 avoscloud-sdk,所以建立此 repo 取消此依赖,以减小体积并避免在前端使用 AppKey。

引入

import { FileMessage, ImageMessage, AudioMessage, VideoMessage, LocationMessage, FileStorage } from 'leancloud-realtime-typed-messages-without-avoscloud';

File

  1. 收: getFile 方法将返回一个自行简单封装的 AV.File 类,可以使用以下方法:
let file = msg.getFile();
let id = file.id;
let url = file.url();
let name = file.name();
let width = file.metaData('width');
  1. 发: 使用以下方法构造 Message:
let file = new FileStorage(id, url, metaData);
let message = new ImageMessage(file);
conversation.send(message).then(...);

Location

  1. 收: getLocation 方法将返回一个包含 latitude 和 longitude 两个属性的对象:
let location = msg.getLocation();
let latitude = location.latitude;
let longitude = location.longitude;
  1. 发: 使用以下方法构造 Message:
let message = new LocationMessage({latitude, longitude});
conversation.send(message).then(...);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published