diff --git a/node/lib/context.ts b/node/lib/context.ts index df6b79078..c10775f45 100644 --- a/node/lib/context.ts +++ b/node/lib/context.ts @@ -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 = { /** the payload, deserialized json: * any javascript primitive, array or object. */ @@ -923,6 +933,11 @@ type WebxdcSendingStatusUpdate = { * 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 = { diff --git a/node/lib/message.ts b/node/lib/message.ts index 427cc44e8..5b2ad67d9 100644 --- a/node/lib/message.ts +++ b/node/lib/message.ts @@ -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))