Skip to content

Commit

Permalink
Merge pull request #11 from glawson/make-windows-work
Browse files Browse the repository at this point in the history
Add Windows support for app second-instance event.
  • Loading branch information
glawson authored Aug 20, 2020
2 parents 5a512e7 + 0dc2cb9 commit f383e8d
Show file tree
Hide file tree
Showing 12 changed files with 6,006 additions and 271 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ This module was inspired due to the lack of protocol support when running non pa

# Please Note

- Not completely ready for Windows (yet!) as you will need to include your own handler to capture the deeplink. Please refer to the [app 'second-instance'](https://www.electronjs.org/docs/api/app#event-second-instance) event for details.
- For Production: While electron-deeplink handles setting `app.setAsDefaultProtocolClient`, you still need to make sure setup the mac bundleId correctly for [electron-builder](https://www.electron.build/configuration/configuration) or [electron-forge](https://www.electronforge.io/configuration).

# Example App
Expand Down Expand Up @@ -48,7 +47,7 @@ Setup a watch on the deeplink 'received' event
```
// main.js
deeplink.on('received', (link) => {
mainWindow.webContents.send('received-link', link);
// do stuff here
});
```

Expand Down
112 changes: 56 additions & 56 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
declare const EventEmitter: any;
interface EventHandler {
(event: Event, args: string): void;
}
interface FuncBool {
(param?: any): boolean;
}
interface FuncVoid {
(param?: any): void;
}
interface FuncString {
(param?: any): string;
}
interface On {
(event: string, callback: EventHandler): void;
}
interface App {
requestSingleInstanceLock: FuncBool;
isDefaultProtocolClient: FuncBool;
setAsDefaultProtocolClient: FuncVoid;
quit: FuncVoid;
on: On;
getAppPath: FuncString;
}
interface MainWindow {
isMinimized: FuncBool;
restore: FuncVoid;
focus: FuncVoid;
}
interface DeeplinkConfig {
protocol: string;
app: App;
mainWindow: MainWindow;
isDev?: boolean;
isYarn?: boolean;
debugLogging?: boolean;
}
declare class Deeplink extends EventEmitter {
private appPath?;
private electronPath?;
private infoPlistFile?;
private infoPlistFileBak?;
private logger?;
private app;
private mainWindow;
private config;
constructor(config: DeeplinkConfig);
private checkConfig;
private setAppProtocol;
private secondInstanceEvent;
private openEvent;
restoreInfoPlist: () => void;
getProtocol: () => string | null;
getLogfile: () => any;
}
export { Deeplink };
declare const EventEmitter: any;
interface FuncBool {
(param?: any): boolean;
}
interface FuncVoid {
(param?: any, path?: any, argv?: any): void;
}
interface FuncString {
(param?: any): string;
}
interface OnCallback {
(event: Event, argv: any): void;
}
interface On {
(event: string, callback: OnCallback): void;
}
interface App {
requestSingleInstanceLock: FuncBool;
isDefaultProtocolClient: FuncBool;
setAsDefaultProtocolClient: FuncVoid;
quit: FuncVoid;
on: On;
getAppPath: FuncString;
}
interface MainWindow {
isMinimized: FuncBool;
restore: FuncVoid;
focus: FuncVoid;
}
interface DeeplinkConfig {
protocol: string;
app: App;
mainWindow: MainWindow;
isDev?: boolean;
isYarn?: boolean;
debugLogging?: boolean;
}
declare class Deeplink extends EventEmitter {
private appPath?;
private electronPath?;
private infoPlistFile?;
private infoPlistFileBak?;
private logger?;
private app;
private mainWindow;
private config;
constructor(config: DeeplinkConfig);
private checkConfig;
private setAppProtocol;
private secondInstanceEvent;
private openEvent;
restoreInfoPlist: () => void;
getProtocol: () => string | null;
getLogfile: () => any;
}
export { Deeplink };
Loading

0 comments on commit f383e8d

Please sign in to comment.