10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-03 20:53:59 +01:00

Use an extension method to fix Array.find don't support async callback

This commit is contained in:
Mickaël Véril 2020-09-21 17:03:10 +02:00
parent 2ecdb00eec
commit 5d4039ea3b
2 changed files with 11 additions and 1 deletions

View File

@ -23,6 +23,7 @@ draft: false
<script src="/js/DebugMode.js"></script> <script src="/js/DebugMode.js"></script>
<script src="/js/numberUtils.js"></script> <script src="/js/numberUtils.js"></script>
<script src="/js/indexDB.js"></script> <script src="/js/indexDB.js"></script>
<script src="/js/ArrayExtensions.js"></script>
<script> <script>
function adjustSticky() { function adjustSticky() {
const height = $("nav").height() const height = $("nav").height()
@ -102,7 +103,7 @@ draft: false
const subset = sub.filter(d => d.set.isSameSet(exSet)) const subset = sub.filter(d => d.set.isSameSet(exSet))
for (mol of uniq(subset.map(d => d.molecule))) { for (mol of uniq(subset.map(d => d.molecule))) {
const submol = subset.filter(d => d.molecule === mol) const submol = subset.filter(d => d.molecule === mol)
const source = submol.find(async (d) => { const source = await submol.findAsync(async (d) => {
if (await d.set.getDOIAsync() === "10.1021/acs.jctc.8b01205") { if (await d.set.getDOIAsync() === "10.1021/acs.jctc.8b01205") {
return d.method.name === "CASPT2" && d.method.basis === "aug-cc-pVDZ" return d.method.name === "CASPT2" && d.method.basis === "aug-cc-pVDZ"
} else { } else {

View File

@ -0,0 +1,9 @@
if (!Array.prototype.findAsync) {
Array.prototype.findAsync = async function findAsync(asyncCallback) {
for (const item of this) {
if (await asyncCallback(item)) {
return item
}
}
}
}