Skip to content

Commit

Permalink
Minor improvment of removeLinkedService from Service class
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Sep 23, 2020
1 parent 62348d3 commit 1a6d30b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/Service.ts
Expand Up @@ -246,8 +246,9 @@ export class Service extends EventEmitter<Events> {

removeLinkedService = (oldLinkedService: Service) => {
//TODO: Add a check if the service is on the same accessory.
if (this.linkedServices.includes(oldLinkedService))
this.linkedServices.splice(this.linkedServices.indexOf(oldLinkedService), 1);
const index = this.linkedServices.indexOf(oldLinkedService);
if (index !== -1)
this.linkedServices.splice(index, 1);
this.emit(ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE, clone({ service: this }));
}

Expand Down

0 comments on commit 1a6d30b

Please sign in to comment.