enhance(frontend): Shareページでの投稿完了時にpostMessageを発火するように (#12505)

* enhance(frontend): Shareページでの投稿完了時にpostMessageを発火

* Update Changelog

* fix

* 名前の混同をさける

* 名前をわかりやすくする

* watchを使わずパフォーマンス改善
This commit is contained in:
かっこかり
2023-11-30 01:08:29 +09:00
committed by GitHub
parent c41d03018c
commit 37cff405ed
3 changed files with 36 additions and 5 deletions

View File

@@ -0,0 +1,25 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
export const postMessageEventTypes = [
'misskey:shareForm:shareCompleted',
] as const;
export type PostMessageEventType = typeof postMessageEventTypes[number];
export type MiPostMessageEvent = {
type: PostMessageEventType;
payload?: any;
};
/**
* 親フレームにイベントを送信
*/
export function postMessageToParentWindow(type: PostMessageEventType, payload?: any): void {
window.postMessage({
type,
payload,
}, '*');
}