2023-11-29 17:08:29 +01:00
|
|
|
/*
|
2024-02-13 16:59:27 +01:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-11-29 17:08:29 +01:00
|
|
|
* 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,
|
|
|
|
}, '*');
|
|
|
|
}
|