-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(modal): removed the modal type enum, updated the modal request f…
…unction and the message class
- Loading branch information
1 parent
194df85
commit 48aa888
Showing
4 changed files
with
45 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { constant, Decoder, mixed, object, string } from 'decoders'; | ||
import { labeledDecoder, LabeledMsg } from './LabeledMsg'; | ||
|
||
/** | ||
* The modal request data. | ||
*/ | ||
export interface ModalRequest { | ||
/** The ID of the modal the client wishes to launch */ | ||
modalId: string; | ||
|
||
/** Any data that the client wishes to send to the modal */ | ||
modalData: any; | ||
} | ||
|
||
/** | ||
* A message used to publish a generic messages | ||
* between the clients and the host application. | ||
*/ | ||
export interface LabeledModalRequest | ||
extends LabeledMsg<'modalRequest', ModalRequest> { | ||
/** Message identifier */ | ||
msgType: 'modalRequest'; | ||
/** Modal request details (type and data) */ | ||
msg: ModalRequest; | ||
} | ||
|
||
const decoder: Decoder<LabeledModalRequest> = labeledDecoder( | ||
constant<'modalRequest'>('modalRequest'), | ||
object({ | ||
modalId: string, | ||
modalData: mixed | ||
}) | ||
); | ||
|
||
export { decoder }; |