Skip to content

Commit

Permalink
Merge pull request #21 from keyoke/keyoke/features
Browse files Browse the repository at this point in the history
refactor bootup
  • Loading branch information
keyoke authored Sep 17, 2021
2 parents d7923b9 + ba348ac commit a07a9cd
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/block-duplicate-observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,29 +254,20 @@ class duplicateObserver implements IWorkItemNotificationListener {
}

export async function main(): Promise<void> {
await SDK.init(<SDK.IExtensionInitOptions>{
explicitNotifyLoaded: true
});
await SDK.init();

// wait until we are ready
await SDK.ready();

// soft-cor.block-duplicate-work-items.block-duplicate-observer or block-duplicate-observer ??
const contributionId: string = SDK.getContributionId();
// Get The ADO Services which we will need later
const locationService: ILocationService = await SDK.getService(CommonServiceIds.LocationService);
const projectService: IProjectPageService = await SDK.getService<IProjectPageService>(CommonServiceIds.ProjectPageService);
const workItemFormService: IWorkItemFormService = await SDK.getService<IWorkItemFormService>(WorkItemTrackingServiceIds.WorkItemFormService);
SDK.register(SDK.getContributionId(), async () => {
// Get The ADO Services which we will need later
const locationService: ILocationService = await SDK.getService(CommonServiceIds.LocationService);
const projectService: IProjectPageService = await SDK.getService<IProjectPageService>(CommonServiceIds.ProjectPageService);
const workItemFormService: IWorkItemFormService = await SDK.getService<IWorkItemFormService>(WorkItemTrackingServiceIds.WorkItemFormService);

// Register our contribution
console.log(contributionId);
SDK.register(contributionId, () => {
// Get the observer
return new duplicateObserver(workItemFormService, locationService, projectService);
});

// notify we are loaded
await SDK.notifyLoadSucceeded();
};

// execute our entrypoint
Expand Down

0 comments on commit a07a9cd

Please sign in to comment.