Skip to content

Commit

Permalink
Direct set SearchParams on URL and remove sort.
Browse files Browse the repository at this point in the history
  • Loading branch information
louis_peng authored and louis_peng committed Apr 16, 2021
1 parent ce0cba1 commit 1de74a5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/types/level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,15 @@ export class HlsUrlParameters {

addDirectives(uri: string): string | never {
const url: URL = new self.URL(uri);
const searchParams: URLSearchParams = url.searchParams;
if (this.msn !== undefined) {
searchParams.set('_HLS_msn', this.msn.toString());
url.searchParams.set('_HLS_msn', this.msn.toString());
}
if (this.part !== undefined) {
searchParams.set('_HLS_part', this.part.toString());
url.searchParams.set('_HLS_part', this.part.toString());
}
if (this.skip) {
searchParams.set('_HLS_skip', this.skip);
url.searchParams.set('_HLS_skip', this.skip);
}
searchParams.sort();
url.search = searchParams.toString();
return url.toString();
}
}
Expand Down

0 comments on commit 1de74a5

Please sign in to comment.