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 { EnvelopeServer } from "@kogito-tooling/envelope-bus/dist/channel"; | |
import { TodoListChannelApi, TodoListEnvelopeApi } from "../api"; | |
export const EmbeddedTodoList = React.forwardRef<TodoListApi, Props>((props, forwardedRef) => { | |
const pollInit = useCallback((envelopeServer: EnvelopeServer<TodoListChannelApi, TodoListEnvelopeApi>) => { | |
return envelopeServer.envelopeApi.requests.todoList__init( | |
{ | |
origin: envelopeServer.origin, | |
envelopeServerId: envelopeServer.id, | |
}, |
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 { TodoListApi, TodoListChannelApi } from "../api"; | |
export type Props = TodoListChannelApi & { | |
targetOrigin: string; | |
envelopePath: string; | |
}; | |
export const EmbeddedTodoList = React.forwardRef<TodoListApi, Props>((props, forwardedRef) => { | |
// ... | |
}); |
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 TodoListEnvelopeApi { | |
todoList__init(association: Association, initArgs: TodoListInitArgs): Promise<void>; | |
todoList__addItem(item: string): Promise<void>; | |
todoList__getItems(): Promise<Item[]>; | |
todoList__markAllAsCompleted(): void; | |
} | |
export interface Association { | |
origin: string; | |
envelopeServerId: string; |
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 TodoListChannelApi { | |
todoList__itemRemoved(item: string): void; | |
} |
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 { Item } from "./TodoListEnvelopeApi"; | |
export interface TodoListApi { | |
addItem(item: string): Promise<void>; | |
getItems(): Promise<Item[]>; | |
markAllAsCompleted(): void; | |
} |
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 { Base64PngEditorFactory } from "base64png-editor"; | |
import { ChannelType, getOperatingSystem } from "@kogito-tooling/channel-common-api"; | |
declare global { | |
export const acquireVsCodeApi: any; | |
} | |
init({ | |
container: document.getElementById("envelope-app")!, |
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 function deactivate() { | |
console.info("Extension is deactivating"); | |
backendProxy?.stopServices(); | |
} |
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 * as vscode from "vscode"; | |
import * as path from "path"; | |
import * as fs from "fs"; | |
let backendProxy: VsCodeBackendProxy; | |
export function activate(context: vscode.ExtensionContext) { | |
// ... | |
context.subscriptions.push( |
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 * as vscode from "vscode"; | |
import * as KogitoVsCode from "@kogito-tooling/vscode-extension"; | |
import { VsCodeBackendProxy } from "@kogito-tooling/backend/dist/vscode"; | |
import { I18n } from "@kogito-tooling/i18n/dist/core"; | |
import { backendI18nDefaults, backendI18nDictionaries } from "@kogito-tooling/backend/dist/i18n"; | |
export function activate(context: vscode.ExtensionContext) { | |
const backendI18n = new I18n(backendI18nDefaults, backendI18nDictionaries, vscode.env.language); | |
backendProxy = new VsCodeBackendProxy(context, backendI18n); |
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 * as vscode from "vscode"; | |
export function activate(context: vscode.ExtensionContext) { | |
console.info("Extension is alive."); | |
// activate code here | |
} | |
export function deactivate() { | |
console.info("Extension is deactivating"); |