What do you want to save?
Add Code snippet
New code examples
-
Other 2022-02-17 02:00:27
bullmq
const { Worker } = require('bullmq') const userSchema = require('./model.js') const { resultsPublisher } = require('./publisher') /** * @description queueCreatePublisher */ const queueCreatePublisher = new Worker('create service', async (job) => { ... Add solution -
Javascript 2022-02-06 18:45:22
javascript return a promise
function doSomething() { return new Promise((resolve, reject) => { console.log("It is done."); // Succeed half of the time. if (Math.random() > .5) { resolve("SUCCESS") } else { reject("FAILURE&... Add solution -
Javascript 2022-02-06 08:45:07
promise definition in javascript
var promise = new Promise(function(resolve, reject) { // do some long running async thing… if (/* everything turned out fine */) { resolve("Stuff worked!"); } else { reject(Error("It broke")); }... Add solution -
Javascript 2022-02-03 08:15:50
mathjax v3
reference : http://docs.mathjax.org/en/latest/upgrading/v2.html Fonts : https://github.com/mathjax/MathJax-src.git Steps are defined as follows : Step 1 : Update cdn and mathjax config ------- <script type="text/x-mathjax-config" defer>... Add solution -
Javascript 2022-02-02 23:01:05
multiple async api calls javascript
// store urls to fetch in an array const urls = [ 'https://dog.ceo/api/breeds/list', 'https://dog.ceo/api/breeds/image/random' ]; // use map() to perform a fetch and handle the response for each url Promise.all(urls.map(url => fetch(url) .th... Add solution -
Javascript 2022-02-02 20:55:16
angular adding delay
//You have to wait for TypeScript 2.0 with async/await for ES5 support as it now supported only for TS to ES6 compilation. //You would be able to create delay function with async: function delay(ms: number) { return new Promise( resolve => setTime... Add solution -
Javascript 2022-02-01 00:35:20
pdf javascript search text
var searchText = "JavaScript"; function searchPage(doc, pageNumber) { return doc.getPage(pageNumber).then(function (page) { return page.getTextContent(); }).then(function (content) { // Search combined text content using regular expr... Add solution