diff --git a/data/corefork.telegram.org/api/web-events.html b/data/corefork.telegram.org/api/web-events.html index d153d315e6..8c5e87351c 100644 --- a/data/corefork.telegram.org/api/web-events.html +++ b/data/corefork.telegram.org/api/web-events.html @@ -42,21 +42,18 @@
When interacting with HTML5 games and the websites of payment gateways, Telegram apps should expose APIs to allow receiving data and events from the websites.
-Games and payment gateways can generate events that are meant to be received by the Telegram apps.
-Typically events are generated by using the postEvent
method of the GamingCommunication library.
-The postEvent
function will try sending the event to the Telegram app in a number of different ways.
Games and payment gateways can generate events that are meant to be received by the Telegram apps.
Typically events are generated by using the postEvent
method of the GamingCommunication library.
The postEvent
function will try sending the event to the Telegram app in a number of different ways.
In mobile apps, the event receiver API should be typically exposed as a window.TelegramWebviewProxy
object with a postEvent
method.
window.TelegramWebviewProxy.postEvent(eventType, eventData)
-Alternatively, a window.external.notify
method can be exposed, accepting a string JSON payload with the event type and payload:
window.external.notify(JSON.stringify({eventType: eventType, eventData: eventData}));
-Finally, web MTProto clients that need to open a game or process a payment in an iframe can use the postMessage API to receive events from iframes.
-The GamingCommunication library by defaultwill use '*'
as targetOrigin
, sending messages to parent pages regardless of the origin of the embedder.
Finally, web MTProto clients that need to open a game or process a payment in an iframe can use the postMessage API to receive events from iframes.
The GamingCommunication library by default will use '*'
as targetOrigin
, sending messages to parent pages regardless of the origin of the embedder.
window.parent.postMessage(JSON.stringify({eventType: eventType, eventData: eventData}), targetOrigin);
-eventType
is a simple string indicating the event type, and eventData
is a payload with an object that will be parsed by the Telegram app.
Will be called by games when the user explicitly clicks on the share game button to share the game, without sharing his score. Typically done by using messages.forwardMessages on the game message without the with_my_score flag, or by sharing the game's short URL. |
game_over |
@@ -98,7 +95,8 @@ The IV iframe embeds, indicates the new size of the embed frame.