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.
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…
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);
…
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 =…
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…
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…
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]
…
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…
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,…
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 = {
…
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…
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…
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,
…
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…
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
}, {
…
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…