-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from SailingSteve/steveStaffClientFeb14-4pm
Sign in via email/password with email verification roughly working.
- Loading branch information
Showing
19 changed files
with
754 additions
and
288 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,39 +1,39 @@ | ||
import { httpLog } from './logging'; | ||
|
||
/* | ||
If we were building the app from scratch, every API query would be conditioned by logic | ||
to make certain the query is necessary. | ||
Important: adding new queries "just to be safe" without proactively determining that they are necessary | ||
will damage the hard earned performance of the WebApp. | ||
This function stops identical queries from being fired within the specified duration in milliseconds | ||
*/ | ||
export default function apiCalming (name, duration = 1000) { | ||
const { apiCalmingDict } = window; | ||
if (!apiCalmingDict) { | ||
window.apiCalmingDict = {}; | ||
} | ||
if (!window.apiCalmingDict[name]) { | ||
window.apiCalmingDict[name] = { | ||
duration, | ||
timeStamp: Date.now(), | ||
}; | ||
httpLog(`== apiCalming for ${name}, make the API call: true, no dict entry yet for this API`); | ||
return true; | ||
} | ||
|
||
const entry = window.apiCalmingDict[name]; | ||
if (entry.timeStamp + duration < Date.now()) { | ||
window.apiCalmingDict[name] = { | ||
duration, | ||
timeStamp: Date.now(), | ||
}; | ||
httpLog(`== apiCalming for ${name}, make the API call: true, duration: ${duration}, previous dict entry has expired`); | ||
return true; | ||
} | ||
const apiCalmingMessageFalse = `== apiCalming for ${name}, make the API call: false, duration: ${duration}, previous calming entry still in force`; | ||
// console.log(apiCalmingMessageFalse); | ||
httpLog(apiCalmingMessageFalse); | ||
return false; | ||
} | ||
// import { httpLog } from './logging'; | ||
// | ||
// /* | ||
// If we were building the app from scratch, every API query would be conditioned by logic | ||
// to make certain the query is necessary. | ||
// | ||
// Important: adding new queries "just to be safe" without proactively determining that they are necessary | ||
// will damage the hard earned performance of the WebApp. | ||
// | ||
// This function stops identical queries from being fired within the specified duration in milliseconds | ||
// */ | ||
// export default function apiCalming (name, duration = 1000) { | ||
// const { apiCalmingDict } = window; | ||
// if (!apiCalmingDict) { | ||
// window.apiCalmingDict = {}; | ||
// } | ||
// if (!window.apiCalmingDict[name]) { | ||
// window.apiCalmingDict[name] = { | ||
// duration, | ||
// timeStamp: Date.now(), | ||
// }; | ||
// httpLog(`== apiCalming for ${name}, make the API call: true, no dict entry yet for this API`); | ||
// return true; | ||
// } | ||
// | ||
// const entry = window.apiCalmingDict[name]; | ||
// if (entry.timeStamp + duration < Date.now()) { | ||
// window.apiCalmingDict[name] = { | ||
// duration, | ||
// timeStamp: Date.now(), | ||
// }; | ||
// httpLog(`== apiCalming for ${name}, make the API call: true, duration: ${duration}, previous dict entry has expired`); | ||
// return true; | ||
// } | ||
// const apiCalmingMessageFalse = `== apiCalming for ${name}, make the API call: false, duration: ${duration}, previous calming entry still in force`; | ||
// // console.log(apiCalmingMessageFalse); | ||
// httpLog(apiCalmingMessageFalse); | ||
// return false; | ||
// } |
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
Oops, something went wrong.