Questions tagged [ecmascript-2017]

Use this tag for questions about features finalized in ECMAScript 2017. Do *not* use this tag if the code in question merely *uses* one of the features, *unless* the feature is cause of the problem.

Proposals finalized in 2017 include:

387 questions
0
votes
1 answer

how to make module asynchronous in javascript

I am new in javascript. I have simple module which sent email using sendgrid : // using SendGrid's v3 Node.js Library // https://github.com/sendgrid/sendgrid-nodejs var helper = require('sendgrid').mail; var fromEmail = new…
amir
  • 2,443
  • 3
  • 22
  • 49
0
votes
0 answers

Testing angular controller with async/await and jasmin

I have the following code in an angularjs controller: async updateGrid() { const paging = angular.copy(this.gridData.getServerCallObj()); try { const model = await this.service.get(paging); …
Rotem B
  • 1,327
  • 1
  • 15
  • 20
0
votes
0 answers

ES6 await is a reserved word

I have the sample code like this: import net from 'net' import B from 'bluebird' class Test { constructor() {} async start() { return await new B((resolve, reject) => { try { this.socketClient =…
TreeCatCat
  • 143
  • 1
  • 1
  • 12
0
votes
0 answers

javascript await keyword, not returning expected value

I am trying to mock up a but of an http2 request object in order to test my usage of it. I am now on node version 7.8.0, so thought I would try and make use of async and await to do things. I have created a mocking class for http2 (although its…
akc42
  • 4,893
  • 5
  • 41
  • 60
0
votes
1 answer

Await and Async callbacks hell

I want to make the UserDataGenerator class works like a traditional SYNC class. My expectation is that userData.outputStructure can give me the data prepared. let userData = new…
newBike
  • 14,385
  • 29
  • 109
  • 192
0
votes
2 answers

javascript async/await version versus Promise version of function doesn't work

I implemented a function using async and it doesn't work. It always resolves immediately and result is always undefined. Here is the original async version: async function validateOne(item, type, state) { const validation = VALIDATIONS[type] …
eagspoo
  • 2,095
  • 3
  • 22
  • 31
0
votes
0 answers

Converting existing js Api to async/await

Let us assume for a moment that I have an already existing API and wish to convert it to async/await style promises. An example call of the API would be Example.call(a,b,function(err,res){ console.log(res); }); Could someone please provide…
Kozos
  • 39
  • 5
0
votes
2 answers

this await throwing unexpected token error

I have a simple async function. It just sends a request and returns the data: export const updatePanorama = async ({ commit }, payload) => { const urlEnd = '/v1/pano/update' const type = 'post' const resp = await api.asyncRequest(urlEnd, type,…
alex
  • 7,111
  • 15
  • 50
  • 77
0
votes
1 answer

Asynchronous functions in constructor

I'm trying to export a class with an asynchronous call in the constructor: my.js: module.exports = class My extends Emitter { constructor () { super() this.db = Object.create(db) this.db.init(cfg) } } db.js: module.exports = { …
Patrick
  • 7,903
  • 11
  • 52
  • 87
0
votes
0 answers

Lazyload with async/await

I use this code to load .eslintrc: const eslintrcs = {}; async function getLintOptions(path) { if (!eslintrcs[path]) { let eslintrc; try { eslintrc = await readFile('./.eslintrc'); eslintrc = await…
David
  • 2,741
  • 16
  • 26
-1
votes
1 answer

Confused about this & getcontext js/ts and how to get around it

So, i have a problem where i'm constantly running into undifined errors, (in browser) and seemingly can't figure out why / how to get around it. From what i've gathered is that the keyword "this" is an utterly confusing mess in js & inherently in ts…
Levente
  • 25
  • 5
-1
votes
1 answer

apply arrow function as object property in typescript

I have following code and wondering if I can apply as arrow function on line data({value}: {value: string}) {return func(value); }, function func(value: string){ return `${value} has been formated` } const rowData = { height: 20, …
jacobcan118
  • 7,797
  • 12
  • 50
  • 95
-1
votes
2 answers

Passing Arguments to function in javascript

I have a function(case) as below, let fn = (() => { let ab = {}; let register = () => { console.log("hello" + ab[x]) }; return (x,y) => { ab[x] = y; return register(); }; })(); this function is working only when I call as…
-1
votes
5 answers

How to get objects from array nested in another object in array with ES6

I have data with the following structure: var DATA = { 'device_groups': [{ 'id': '1', 'name': 'group 1', 'devices': [{ 'id': 11, 'name': 'device 11', 'active': 1 }, { 'id': 12, 'name': 'device 12', 'active': 0 }, { …
Igal
  • 5,833
  • 20
  • 74
  • 132
-1
votes
1 answer

No atomics in Chrome?

According to the chrome feature status page chrome should have this enabled by default starting version 60 but SharedArrayBuffer and Atomics are undefined on the following: Desktop Chrome 65 Linux Desktop Chrome 67 Canary MacOSX High Sierra Desktop…
Jared Smith
  • 19,721
  • 5
  • 45
  • 83
1 2 3
25
26