forked from video-dev/hls.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
529 additions
and
523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export function sortObject(obj) { | ||
if(typeof obj !== 'object') { | ||
return obj; | ||
} | ||
let temp = {}; | ||
let keys = []; | ||
for(let key in obj) { | ||
keys.push(key); | ||
} | ||
keys.sort(); | ||
for(let index in keys) { | ||
temp[keys[index]] = sortObject(obj[keys[index]]); | ||
} | ||
return temp; | ||
} | ||
|
||
export function copyTextToClipboard(text) { | ||
let textArea = document.createElement('textarea'); | ||
textArea.value = text; | ||
document.body.appendChild(textArea); | ||
textArea.select(); | ||
try { | ||
let successful = document.execCommand('copy'); | ||
let msg = successful ? 'successful' : 'unsuccessful'; | ||
console.log('Copying text command was ' + msg); | ||
} catch (err) { | ||
console.log('Oops, unable to copy'); | ||
} | ||
document.body.removeChild(textArea); | ||
} | ||
|
Oops, something went wrong.