ecmascript-next Questions
1
Solved
Javascript allows you to see what time it is in another timezone if you specify the IANA given name of that timezone. For example:
let strTime = new Date().toLocaleString("en-US", {timeZone: "A...
Zygophyte asked 31/1, 2019 at 11:40
5
Solved
I am using ReactJS with Babel and Webpack and using ES6 as well as the proposed class fields for arrow functions. I understand that arrow functions make things more efficient by not recreating the ...
Turbinal asked 9/2, 2018 at 5:55
3
Solved
I'm looking at some ES6 code and I don't understand what the @ symbol does when it is placed in front of a variable. The closest thing I could find has something to do with private fields?
Code I ...
Imponderable asked 4/8, 2015 at 23:34
3
Solved
According to this babel documentation, the correct way to use ES6+ with React is to initial components like this:
class Video extends React.Component {
static defaultProps = {
autoPlay: false,
...
Sanjiv asked 13/6, 2016 at 11:14
2
Solved
I wrote some code:
class Base {
// Default value
myColor = 'blue';
constructor() {
console.log(this.myColor);
}
}
class Derived extends Base {
myColor = 'red';
}
// Prints "blue", expect...
Peruse asked 24/4, 2017 at 19:8
5
Solved
I want to check if an async function throws using assert.throws from the native assert module.
I tried with
const test = async () => await aPromise();
assert.throws(test); // AssertionError: Mi...
Michail asked 3/3, 2016 at 20:32
4
Solved
Say I have a function object-
setObj : function(a,b){
obj.a = a;
obj.b = b;
}
If I have to use async & await on this function object, how do I do it?
If the same was written in function (...
Quinquennial asked 10/12, 2015 at 20:8
4
Solved
I'm new to using ES6 classes with React, previously I've been binding my methods to the current object (show in first example), but does ES6 allow me to permanently bind a class function to a class...
Labourer asked 11/7, 2015 at 22:5
3
Solved
I am refactoring an es6 class based React component that uses the normal constructor, and then binds methods, and defines state/attributes within that constructor. Something like this:
class MySpe...
Delorasdelorenzo asked 21/6, 2017 at 19:13
1
Solved
I have tried searching through TypeScripts documentation on their configurtion and can't seem to find the answer to what should be a simple question.
Simply, how does one configure the typescript ...
Odisodium asked 26/6, 2018 at 12:52
2
Solved
I'm trying to use rxjs in conjunction with babeljs to create an async generator function that yields when next is called, throws when error is called, and finishes when complete is called. The prob...
Locally asked 22/5, 2017 at 22:38
2
I need Tooltip component from two libraries. For example
import { Tooltip } from "react-leaflet";
import { Tooltip } from "recharts";
But the same name of Tooltip of two libraries, I get an erro...
Readable asked 28/4, 2018 at 8:1
4
Solved
This is the way I've been doing it for quite some time now:
export default class AttachmentCreator extends Component {
render() {
return <div>
<RaisedButton primary label="Add Attachme...
Curtilage asked 21/4, 2016 at 18:59
3
Solved
I'm currently writing small NodeJS CLI tool for personal usage and I've decided to try ES7 async/await feature with Babel.
It's a network tool so I obviously have asynchronous network requests. I...
Mcadams asked 13/2, 2016 at 12:58
2
Solved
Can someone explain how Babel in React supports fat arrow functions as class properties?
Using Babel Try it out I can see they are not supported:
class Question {
// Property (not supported)
my...
Stellular asked 18/3, 2018 at 17:13
2
Solved
I'm struggling a bit with async/await and returning a value from a Promise.
function test () {
return new Promise((resolve, reject) => {
resolve('Hello')
})
}
async function c() {
await t...
Sunward asked 8/8, 2016 at 21:57
4
Solved
As the question stated. Will I be allowed to do this:
class MyClass {
async constructor(){
return new Promise()
}
}
Socialize asked 1/4, 2016 at 18:21
1
Solved
I am trying to understand how to use decorators in a very simple piece of code, so I can apply this concept to my bigger project. Taking cue from Addy Osmani's article here, I created a simple piec...
Convolute asked 2/1, 2018 at 4:58
1
Solved
Suppose I have a function that takes a generator and returns another generator of the first n elements:
const take = function * (n, xs) {
console.assert(n >= 0);
let i = 0;
for (const x of ...
Invention asked 15/12, 2017 at 14:19
2
Need a little help with some JS. Is it possible to bind an animated event as needed below?
I need to do this:
onScroll={
Animated.event([
{
nativeEvent: {
contentOffset: {y: this.state.animTo...
Manamanacle asked 10/3, 2017 at 10:52
2
Solved
Currently, the only stable way to process a series of async results in JavaScript is using the event system. However, three alternatives are being developed:
Streams: https://streams.spec.whatwg.o...
Bedridden asked 11/9, 2016 at 19:6
4
Solved
I can easily make a plain object look like an array by setting its prototype to Array.prototype:
const obj = {};
Reflect.setPrototypeOf(obj, Array.prototype);
(I'm aware that there are also some...
Lamont asked 15/12, 2016 at 17:34
2
Solved
I understand there is a TC-39 proposal for a new syntax called "property initializer syntax" in JavaScript classes.
I haven't yet found much documentation for this, but it is used in an egghead co...
Quickfreeze asked 4/6, 2017 at 20:26
1
Solved
Is there any reason to write classic syntax of ES6 methods?
class MyClass {
myMethod() {
this.myVariable++;
}
}
When I use myMethod() as callback on some event, I must write something like ...
Naked asked 26/8, 2017 at 14:1
4
Solved
I'd like to inject lodash by name, something like this:
let val = function(lodash){
// lodash will be injected, simply by using require('lodash');
};
but say I want to rename the import, I want...
Bhutan asked 18/6, 2017 at 19:34
© 2022 - 2024 — McMap. All rights reserved.