diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2023-11-30 01:08:29 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-30 01:08:29 +0900 |
| commit | 37cff405ed620a9a885475f63067446c56c58415 (patch) | |
| tree | 47737456cded772670ac522a13289309fb7aca9b /packages/frontend/src/scripts/post-message.ts | |
| parent | ci: use refs/pull/*/merge to get head (#12508) (diff) | |
| download | misskey-37cff405ed620a9a885475f63067446c56c58415.tar.gz misskey-37cff405ed620a9a885475f63067446c56c58415.tar.bz2 misskey-37cff405ed620a9a885475f63067446c56c58415.zip | |
enhance(frontend): Shareページでの投稿完了時にpostMessageを発火するように (#12505)
* enhance(frontend): Shareページでの投稿完了時にpostMessageを発火
* Update Changelog
* fix
* 名前の混同をさける
* 名前をわかりやすくする
* watchを使わずパフォーマンス改善
Diffstat (limited to 'packages/frontend/src/scripts/post-message.ts')
| -rw-r--r-- | packages/frontend/src/scripts/post-message.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/frontend/src/scripts/post-message.ts b/packages/frontend/src/scripts/post-message.ts new file mode 100644 index 0000000000..80441caf15 --- /dev/null +++ b/packages/frontend/src/scripts/post-message.ts @@ -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, + }, '*'); +} |