This file contains hidden or 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
import { init } from "todo-list-view/dist/envelope"; | |
import { EnvelopeBusMessage } from "@kogito-tooling/envelope-bus/dist/api"; | |
init({ | |
container: document.getElementById("envelope-app")!, | |
bus: { | |
postMessage<D, Type>(message: EnvelopeBusMessage<D, Type>, targetOrigin?: string, transfer?: any) { | |
window.parent.postMessage(message, "*", transfer); | |
}, | |
}, |
This file contains hidden or 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
import { ChannelType, getOperatingSystem } from "@kogito-tooling/channel-common-api"; | |
import { init } from "@kogito-tooling/editor/dist/envelope"; | |
import { CompositeEditorFactory } from "@kogito-tooling/editor/dist/envelope"; | |
import { EnvelopeBusMessage } from "@kogito-tooling/envelope-bus/dist/api"; | |
import { GwtEditorWrapperFactory } from "@kogito-tooling/kie-bc-editors"; | |
init({ | |
container: document.getElementById("envelope-app")!, | |
bus: { | |
postMessage<D, Type>(message: EnvelopeBusMessage<D, Type>, targetOrigin?: string, _?: any) { |
This file contains hidden or 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
import { init } from "@kogito-tooling/editor/dist/envelope"; | |
import { CompositeEditorFactory } from "@kogito-tooling/editor/dist/envelope"; | |
import { EnvelopeBusMessage } from "@kogito-tooling/envelope-bus/dist/api"; | |
import { ChannelType, getOperatingSystem } from "@kogito-tooling/channel-common-api"; | |
import { Base64PngEditorFactory } from "base64png-editor"; | |
init({ | |
container: document.getElementById("envelope-app")!, | |
bus: { | |
postMessage<D, Type>(message: EnvelopeBusMessage<D, Type>, targetOrigin?: string, _?: any) { |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<style> | |
html, | |
body, | |
div#envelope-app { | |
margin: 0; | |
border: 0; | |
padding: 0; |
This file contains hidden or 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
import { MessageBusClientApi } from "@kogito-tooling/envelope-bus/dist/api"; | |
// ... | |
export class PingPongReactImplFactory implements PingPongFactory { | |
public create(initArgs: PingPongInitArgs, channelApi: MessageBusClientApi<PingPongChannelApi>) { | |
const ref = React.createRef<PingPongApi>(); | |
const pingPongView: PingPong = { | |
reactComponent: () => <PingPongReactImpl initArgs={initArgs} channelApi={channelApi} ref={ref} />, | |
}; |
This file contains hidden or 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
export interface PingPongEnvelopeViewApi { | |
setView(page: PingPong): Promise<void>; | |
} | |
export const PingPongEnvelopeView = React.forwardRef((props, forwardedRef) => { | |
const [view, setView] = useState<PingPong>(); | |
useImperativeHandle(forwardedRef, () => ({ setView: setView }), []); | |
return ( |
This file contains hidden or 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
import { EnvelopeApiFactoryArgs } from "@kogito-tooling/envelope"; | |
import { Association, PingPongChannelApi, PingPongEnvelopeApi, PingPongInitArgs } from "../api"; | |
// ... | |
export class PingPongEnvelopeApiImpl implements PingPongEnvelopeApi { | |
constructor( | |
private readonly args: EnvelopeApiFactoryArgs< | |
PingPongEnvelopeApi, | |
PingPongChannelApi, | |
PingPongEnvelopeViewApi, |
This file contains hidden or 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
import { EnvelopeBus } from "@kogito-tooling/envelope-bus/dist/api"; | |
import { Envelope } from "@kogito-tooling/envelope"; | |
import { PingPongChannelApi, PingPongEnvelopeApi } from "../api"; | |
// ... | |
export function init(args: { container: HTMLElement; bus: EnvelopeBus; pingPongViewFactory: PingPongFactory }) { | |
const envelope = new Envelope< | |
PingPongEnvelopeApi, | |
PingPongChannelApi, | |
PingPongEnvelopeViewApi, |
This file contains hidden or 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
import { PingPongApi } from "../api"; | |
export interface PingPong extends PingPongApi { | |
reactComponent?(): React.ReactNode; | |
} |
This file contains hidden or 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
import { MessageBusClientApi } from "@kogito-tooling/envelope-bus/dist/api"; | |
import { PingPongChannelApi, PingPongInitArgs } from "../api"; | |
export interface PingPongFactory { | |
create(initArgs: PingPongInitArgs, channelApi: MessageBusClientApi<PingPongChannelApi>): PingPong; | |
} |