mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-11 13:38:46 +00:00
Initial Move from Azure DevOps to GitHub
This commit is contained in:
30
src/GitHub/GitHubConnector.ts
Normal file
30
src/GitHub/GitHubConnector.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
export interface IGitHubConnectorParams {
|
||||
state: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
export const GitHubConnectorMsgType = "GitHubConnectorMsgType";
|
||||
|
||||
export class GitHubConnector {
|
||||
public start(params: URLSearchParams, window: Window & typeof globalThis) {
|
||||
window.postMessage(
|
||||
{
|
||||
type: GitHubConnectorMsgType,
|
||||
data: {
|
||||
state: params.get("state"),
|
||||
code: params.get("code")
|
||||
} as IGitHubConnectorParams
|
||||
},
|
||||
window.location.origin
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var connector = new GitHubConnector();
|
||||
window.addEventListener("load", () => {
|
||||
const openerWindow = window.opener;
|
||||
if (openerWindow) {
|
||||
connector.start(new URLSearchParams(document.location.search), openerWindow);
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user