728x90
반응형
- 2023-05-23 : First posting.
$.ajax({type:"POST"})
request 가 http://recoeve.net/user/kipid/get-Recos 로 요청해서 recos 를 받아야 하는데 server log 에 이런 요청 자체가 안뜸.
어딘가에서 await 로 끝나지 않는 function 이 있는거 같은데 중간에... 어딘지 모르겠음.
## m.openCat(cat, event)
```[.linenums.lang-js]
/////////////////////////////////////////
// Open Cat
/////////////////////////////////////////
m.doNotOpenCat=true;
m.openCat=async function (cat, e) {
return new Promise(async function (resolve, reject) {
if (e?.which===2) { // wheel click.
resolve(true);
// return true;
}
m.currentCat=cat;
let fs1=m.fsToRs;
fs1.shuffled=null;
for (let l=0;l<m.fsGo.fullList.length;l++) {
m.fsGo.fullList[l].$listI=null;
}
await m.getUriListAndShowRecosOnCat(cat);
if (!m.initialOpen) {
m.doNotOpenCat=false;
window.history.pushState({cat:m.currentCat, mode:m.recoMode, goOn:m.goOn, ToRsOn:m.ToRsOn}, "", m.pathOfCat(m.currentCat, m.recoMode));
}
$title.html(`${cat?`${m.escapeHTML(cat)} of `:""}${m.userId}'s recoeve.net`);
resolve(false);
// return false;
});};
```/
## m.getUriListAndShowRecosOnCat(cat)
```[.linenums.lang-js]
m.getUriListAndShowRecosOnCat=async function (cat) {
return new Promise(async function (resolve, reject) {
switch (m.recoMode) {
case "neighbors":
$numbers_of_recos.html("Loading neighbors, and plotting charts.");
$contents.html("");
resolve();
return;
case "multireco": case "": default:
$numbers_of_recos.html(`Loading recos in cat=${m.escapeHTML(cat)}...`);
let catI=m.catList[cat];
if (catI) {
$catList.find(".cat").removeClass("selected");
let $cat=$("#cat-"+catI.i);
$cat.addClass("selected");
let $parents=$cat.parents(".subCat");
for (let i=$parents.length-1;i>=0;i--) {
if (!$parents.eq(i).is(":visible")) {
$parents.eq(i).prev().find(">.EC").trigger("click");
}
}
let catUriList=m.catUriList[cat]=m.catUriList[cat]||{};;
if (catUriList.down) {
await m.getAndShowRecosOnCat(cat);
}
else {
await m.getUriList(
"cat\n"+(cat===""?"\tp":cat),
async function () {
return new Promise(async function (resolve, reject) {
$numbers_of_recos.html(`get-UriList on cat=${m.escapeHTML(cat)} has failed.`);
$contents.html("");
resolve();
});
},
async function () {
return new Promise(async function (resolve, reject) {
catUriList.down=true;
await m.getAndShowRecosOnCat(cat);
resolve();
});
}
);
}
}
else {
$numbers_of_recos.html(`Category "${m.escapeHTML(cat)}" does not exist.`);
$contents.html("");
}
resolve();
return;
}
});};
```/
## m.getUriList(getUriListStr, failFn, doneFn)
```[.linenums.lang-js]
m.getUriList=async function (getUriListStr, failFn, doneFn) {
return new Promise(async function (resolve, reject) {
$.ajax({
type:"POST", url:m.userPath+"/get-UriList", data:getUriListStr
, dataType:"text"
}).fail(async function () {
// if (typeof failFn==="function") {
await failFn();
// }
resolve();
}).done(async function (resp) {
resp=m.strToJSON(resp);
for (let i=1;i<resp.length;i++) {
let catUL=m.catUriList[resp[i].cat];
catUL.down=true;
catUL.has=true;
for (let p in resp[i]) {
if (isNaN(p)) {
catUL[p]=resp[i][p]; // cat, UriList
}
}
catUL.uris=[];
if (catUL.UriList?.length!==0) {
catUL.uris=catUL.UriList.split("\n");
}
}
// if (typeof doneFn==="function") {
await doneFn();
// }
resolve();
});
return;
});};
```/
## RRA
728x90
반응형
'[Recoeve.net]' 카테고리의 다른 글
스타트업 경영해 나갈때 참조할 만한 글들 (0) | 2023.10.29 |
---|---|
개인화 된 추천 시스템 (Personalized recommendation system) (3) | 2023.10.25 |
Auto Completion, and Fuzzy Search (2) | 2023.05.31 |
Exception: java.sql.SQLException: java.time.LocalDateTime to SQL type (0) | 2023.05.30 |
음식점 할인정보 정리 (App Surprise) (0) | 2022.12.30 |
Programmer/Developer's Portfolio (개발자/프로그래머의 포트폴리오) (2) | 2022.12.28 |
URI rendering test (2) | 2022.12.28 |