-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow loading of script to be deferred (#2)
- Loading branch information
Showing
9 changed files
with
218 additions
and
124 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 |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
.release-it.js | ||
node_modules | ||
RELEASE.md | ||
rollup.config.js | ||
rollup.config.js | ||
src |
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
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
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
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
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,7 @@ | ||
const assertKeyValue = (key, value) => { | ||
if (!value) { | ||
throw new Error(`TelemetryDeck: "${key}" is not set`); | ||
} | ||
}; | ||
|
||
export default assertKeyValue; |
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,15 @@ | ||
// https://stackoverflow.com/a/48161723/54547 | ||
export default async function sha256(message) { | ||
// encode as UTF-8 | ||
const messageBuffer = new TextEncoder().encode(message); | ||
|
||
// hash the message | ||
const hashBuffer = await crypto.subtle.digest('SHA-256', messageBuffer); | ||
|
||
// convert ArrayBuffer to Array | ||
const hashArray = [...new Uint8Array(hashBuffer)]; | ||
|
||
// convert bytes to hex string | ||
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join(''); | ||
return hashHex; | ||
} |
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,3 @@ | ||
const transformPayload = (payload) => Object.entries(payload).map((entry) => entry.join(':')); | ||
|
||
export default transformPayload; |
Oops, something went wrong.