function checkGrammar(text){
const opts = {
headers: {
"accept": "application/vnd.splat+json",
}
}
return new Promise(async (resolve) => {
let job = await fetch("https://api.cram.com/article-evaluations", {
"body": JSON.stringify({
"text": text,
"evaluate":["grammar","plagiarism"]
}),
"method": "POST",
...opts,
}).then(res => res.json())
let int = setInterval(async () => {
let res = await fetch(`https://api.cram.com/article-evaluations/${job.data.id}`, {
"headers": {
"accept": "application/vnd.splat+json",
},
"method": "GET",
}).then(res => res.json())
if (res.data.is_success === 1){
clearInterval(int);
return resolve(res.data.result);
}
}, 500)
});
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter