Skip to content

Commit

Permalink
added 'getInfo' 1.2 api, linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nkolba committed Mar 29, 2022
1 parent 44d0a74 commit dfc4969
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/main/src/listeners/fdc3Listeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ _listeners.push({
console.log(
'check pending',
pending.context,
(pending.context ? pending.context.type : "no pending object"),
pending.context ? pending.context.type : 'no pending object',
msg.data.type,
msg.data.id,
msg.data.type === undefined ||
Expand Down
2 changes: 1 addition & 1 deletion packages/preload/exposedInMainWorld.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ interface Window {
readonly versions: NodeJS.ProcessVersions;
readonly workspace: { isConnected: () => boolean; };
readonly home: { getApps: () => Promise<unknown>; };
readonly fdc3: { open: (name: string, context?: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/context/ContextTypes").Context) => Promise<any>; broadcast: (context: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/context/ContextTypes").Context) => void; raiseIntent: (intent: string, context: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/context/ContextTypes").Context, target: string) => Promise<any>; addContextListener: (contextType: any, handler?: any) => Listener; addIntentListener: (intent: string, listener: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/api/Types").ContextHandler) => Listener; findIntent: (intent: string, context: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/context/ContextTypes").Context) => Promise<any>; findIntentsByContext: (context: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/context/ContextTypes").Context) => Promise<any>; getSystemChannels: () => Promise<any>; getOrCreateChannel: (channelId: string) => Promise<any>; joinChannel: (channel: string) => Promise<void>; leaveCurrentChannel: () => Promise<any>; getCurrentChannel: () => Promise<any>; getAppInstance: (instanceId: string) => Promise<import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/packages/main/src/types/AppInstance").AppInstance>; };
readonly fdc3: { getInfo(): import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/api/ImplementationMetadata").ImplementationMetadata; open: (name: string, context?: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/context/ContextTypes").Context) => Promise<any>; broadcast: (context: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/context/ContextTypes").Context) => void; raiseIntent: (intent: string, context: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/context/ContextTypes").Context, target: string) => Promise<any>; addContextListener: (contextType: any, handler?: any) => Listener; addIntentListener: (intent: string, listener: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/api/Types").ContextHandler) => Listener; findIntent: (intent: string, context: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/context/ContextTypes").Context) => Promise<any>; findIntentsByContext: (context: import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/node_modules/@finos/fdc3/dist/context/ContextTypes").Context) => Promise<any>; getSystemChannels: () => Promise<any>; getOrCreateChannel: (channelId: string) => Promise<any>; joinChannel: (channel: string) => Promise<void>; leaveCurrentChannel: () => Promise<any>; getCurrentChannel: () => Promise<any>; getAppInstance: (instanceId: string) => Promise<import("/Users/nicholaskolba/connectifi/agent/electron-fdc3/packages/main/src/types/AppInstance").AppInstance>; };
}
15 changes: 14 additions & 1 deletion packages/preload/src/view/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { contextBridge } from 'electron';
import utils from '../../../main/src/utils';
import { Listener as fdc3Listener } from '@finos/fdc3';
import { Context, DisplayMetadata, ContextHandler, Channel } from '@finos/fdc3';
import {
Context,
DisplayMetadata,
ContextHandler,
Channel,
ImplementationMetadata,
} from '@finos/fdc3';
import { FDC3Event, FDC3EventDetail } from '../../../main/src/types/FDC3Event';
import { FDC3EventEnum } from '../../../main/src/types/FDC3Event';
import { TOPICS } from '../../../main/src/constants';
Expand Down Expand Up @@ -203,6 +209,13 @@ export function createAPI() {
};

const DesktopAgent = {
getInfo(): ImplementationMetadata {
return {
fdc3Version: '1.2',
provider: 'electron-fdc3',
};
},

open: (name: string, context?: Context) => {
return wireMethod('open', { name: name, context: context });
},
Expand Down

0 comments on commit dfc4969

Please sign in to comment.