add webxdc document property to deltachat node typings

This commit is contained in:
Simon Laux
2022-05-16 14:08:43 +02:00
committed by Simon Laux
parent d790a5fba9
commit 1f8b04bd42
2 changed files with 17 additions and 1 deletions

View File

@@ -910,6 +910,16 @@ export class Context extends EventEmitter {
}
}
export type WebxdcInfo = {
name: string
icon: string
summary: string
/**
* if set by the webxdc, name of the document in edit
*/
document?: string
}
type WebxdcSendingStatusUpdate<T> = {
/** the payload, deserialized json:
* any javascript primitive, array or object. */
@@ -923,6 +933,11 @@ type WebxdcSendingStatusUpdate<T> = {
* it is recommended to use some aggregated value,
* eg. "8 votes", "Highscore: 123" */
summary?: string
/**
* optional, name of the document in edit,
* must not be used eg. in games where the Webxdc does not create documents
*/
document?: string
}
type WebxdcReceivedStatusUpdate<T> = {

View File

@@ -4,6 +4,7 @@ import binding from './binding'
import { C } from './constants'
import { Lot } from './lot'
import { Chat } from './chat'
import { WebxdcInfo } from './context'
const debug = require('debug')('deltachat:node:message')
export enum MessageDownloadState {
@@ -157,7 +158,7 @@ export class Message {
return binding.dcn_msg_get_chat_id(this.dc_msg)
}
get webxdcInfo(): { name: string; icon: string; summary: string } | null {
get webxdcInfo(): WebxdcInfo | null {
let info = binding.dcn_msg_get_webxdc_info(this.dc_msg)
return info
? JSON.parse(binding.dcn_msg_get_webxdc_info(this.dc_msg))