async-await

How to avoid “Synchronous XMLHttpRequest on the main thread” warning in UI5?

此生再无相见时 提交于 2020-12-11 00:57:36
问题 I'm staring my UI5 with the following bootstrapping in index.js : sap.ui.define([ "sap/m/Shell", "sap/ui/core/ComponentContainer" ], (Core, Shell, ComponentContainer) => { "use strict"; new Shell("", { app: new ComponentContainer("", { height: "100%", name: "webapp" }), appWidthLimited: false }).placeAt("content"); }); According to the UI5 documentation: Static dependencies are loaded in the dependency declaration array of the sap.ui.define call. These dependencies are always loaded in

How to avoid “Synchronous XMLHttpRequest on the main thread” warning in UI5?

给你一囗甜甜゛ 提交于 2020-12-11 00:46:55
问题 I'm staring my UI5 with the following bootstrapping in index.js : sap.ui.define([ "sap/m/Shell", "sap/ui/core/ComponentContainer" ], (Core, Shell, ComponentContainer) => { "use strict"; new Shell("", { app: new ComponentContainer("", { height: "100%", name: "webapp" }), appWidthLimited: false }).placeAt("content"); }); According to the UI5 documentation: Static dependencies are loaded in the dependency declaration array of the sap.ui.define call. These dependencies are always loaded in

Iterating an IAsyncEnumerable in a function returning an IAsyncEnumerable with cancellation

◇◆丶佛笑我妖孽 提交于 2020-12-09 05:10:39
问题 As the title says, I have to following function: public async IAsyncEnumerable<Job> GetByPipeline(int pipelineId, [EnumeratorCancellation] CancellationToken cancellationToken = default) { await foreach (var job in context.Jobs.Where(job => job.Pipeline.Id == pipelineId) .AsAsyncEnumerable() .WithCancellation(cancellationToken) .ConfigureAwait(false)) { yield return job; } } I have trouble wrapping my head around where the cancellation token is going, and a nagging feeling that I am using it

Firebase Query Collection And Merge Subcollection Data

天涯浪子 提交于 2020-12-05 07:03:33
问题 I'm trying to figure out a way to get a collection of documents along with their subcollection data. For example, my tree is... -locations -{locationId} -historic -april -airTemp: 12.4 -displayOrder: 4 -august -airTemp: 14.5 -displayOrder: 9 -december -airTemp: 13.5 -displayOrder: 12 etc.. ...where locationId is a document and historic is the subcollection with monthly documents in it. I know how to get the top level collection items and store it into an array but I want to add their

How to setTimeout on async await call node

試著忘記壹切 提交于 2020-12-04 18:37:02
问题 How can I add a setTimeout to my async await function call? I have request = await getProduct(productids[i]); where const getProduct = async productid => { return requestPromise(url + productid); }; I've tried request = await setTimeout((getProduct(productids[i])), 5000); and got the error TypeError: "callback" argument must be a function which makes sense. The request is inside of a loop which is making me hit the rate limit on an api call. exports.getProducts = async (req, res) => { let

How to setTimeout on async await call node

南楼画角 提交于 2020-12-04 18:31:45
问题 How can I add a setTimeout to my async await function call? I have request = await getProduct(productids[i]); where const getProduct = async productid => { return requestPromise(url + productid); }; I've tried request = await setTimeout((getProduct(productids[i])), 5000); and got the error TypeError: "callback" argument must be a function which makes sense. The request is inside of a loop which is making me hit the rate limit on an api call. exports.getProducts = async (req, res) => { let

How to implement the OnCompleted method of a custom awaiter correctly?

。_饼干妹妹 提交于 2020-12-03 11:58:13
问题 I have a custom awaitable type and the problem is that the continuation resumes on a different thread, which causes problems in UIs such as WinForms/WPF/MVC/etc: private MyAwaitable awaitable; private async void buttonStart_Click(object sender, EventArgs e) { awaitable = new MyAwaitable(false); progressBar1.Visible = true; // A regular Task can marshal the execution back to the UI thread // Here ConfigureAwait is not available and I don't know how to control the flow var result = await

Unexpected unhandledRejection event for promise which rejection does get handled

拟墨画扇 提交于 2020-12-02 08:14:53
问题 Updated , I've now tried explaining the behavior I'm seeing, but it'd still be great to have an answer from a credible source about the unhandledRejection behavor. I've also started a discussion thread on Reddit. Why do I get an unhandledRejection event (for "error f1") in the following code? That's unexpected, because I handle both rejections in the finally section of main . I'm seeing the same behavior in Node (v14.13.1) and Chrome (v86.0.4240.75): window.addEventListener(

Unexpected unhandledRejection event for promise which rejection does get handled

痴心易碎 提交于 2020-12-02 08:12:42
问题 Updated , I've now tried explaining the behavior I'm seeing, but it'd still be great to have an answer from a credible source about the unhandledRejection behavor. I've also started a discussion thread on Reddit. Why do I get an unhandledRejection event (for "error f1") in the following code? That's unexpected, because I handle both rejections in the finally section of main . I'm seeing the same behavior in Node (v14.13.1) and Chrome (v86.0.4240.75): window.addEventListener(

Puppeteer doesn't close browser

丶灬走出姿态 提交于 2020-12-02 06:55:30
问题 I'm running puppeteer on express/node/ubuntu as follow: var puppeteer = require('puppeteer'); var express = require('express'); var router = express.Router(); /* GET home page. */ router.get('/', function(req, res, next) { (async () => { headless = true; const browser = await puppeteer.launch({headless: true, args:['--no-sandbox']}); const page = await browser.newPage(); url = req.query.url; await page.goto(url); let bodyHTML = await page.evaluate(() => document.body.innerHTML); res.send