mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-21 02:55:25 +02:00
refactor(frontend): scripts -> utility
This commit is contained in:
25
packages/frontend/src/utility/post-message.ts
Normal file
25
packages/frontend/src/utility/post-message.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* 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.parent.postMessage({
|
||||
type,
|
||||
payload,
|
||||
}, '*');
|
||||
}
|
||||
Reference in New Issue
Block a user