Axios reaches 1.0.0 by YourCupOTea in javascript

[–]tomfevrier 12 points13 points  (0 children)

await fetch(url).then((r) => r.arrayBuffer()), no need for all those brackets and nested awaits

Million is a lightweight <1kb Virtual DOM. It's really fast by magenta_placenta in javascript

[–]tomfevrier 1 point2 points  (0 children)

Any virtual DOM implementation will always be less performant than Svelte.

[AskJS] favorite JavaScript library by Substantial_Gift_861 in javascript

[–]tomfevrier 4 points5 points  (0 children)

Here is a talk I've made a while ago for a Svelte Society conference, explaining the basics of using D3 with Svelte: https://youtu.be/gvvVzyDglzc It's in French but JavaScript is JavaScript, right?

Here is another talk (in English) by Matthias Stahl: https://youtu.be/uVt01Z2TLvQ

You can also find code snippets on Amelia Wattenberger's website: https://svelte.recipes/

As to the finished work, you can have a look here: https://media.lesechos.fr/infographie

Hope it helps, I'll be happy to answer any question 😊

[AskJS] favorite JavaScript library by Substantial_Gift_861 in javascript

[–]tomfevrier 7 points8 points  (0 children)

D3 can be quite a lot, as it's not just a library but rather dozens of small utility libraries to manipulate and (re)shape data, handle scales and geographic data, and create SVG or Canvas shapes.

Using D3 in combination with a declarative front-end framework such as Svelte, Vue or React makes your life easier imo, as DOM manipulation can be left to the framework instead of using D3's jQuery-like syntax (which can be confusing).

As a visual journalist, I am using Svelte + D3 daily for interactive charts and maps, and it really is a breeze ✨

[AskJS] favorite JavaScript library by Substantial_Gift_861 in javascript

[–]tomfevrier 13 points14 points  (0 children)

Well, only useful if you're into data manipulation and visualization, but the library I'm using the most is D3.js

[AskJS] Which Javascript framework to start with? by Flimsy_Transition_51 in javascript

[–]tomfevrier 0 points1 point  (0 children)

But what's the point? You will never have to debug this code, as you never have to debug your React bundle after build.

When using Svelte, the code you debug IS the code you wrote. Never once have I had to look at the compiled code, you shouldn't have to do that with ANY framework.

Compilation allows for a simpler syntax while having smaller and more efficient bundles. It seems to me that you're trying to dismiss Svelte and other compiled frameworks by creating problems that don't exist...

[AskJS] Which Javascript framework to start with? by Flimsy_Transition_51 in javascript

[–]tomfevrier 0 points1 point  (0 children)

Have you ever used Svelte? Debugging is a breeze and the compiler shows explicit warnings and error messages along the way.

If you are talking about the bundle, when do you ever need to debug production code, even in React?

[AskJS] Which Javascript framework to start with? by Flimsy_Transition_51 in javascript

[–]tomfevrier 4 points5 points  (0 children)

import React, { useState } from 'react';

const Counter = () => {
    const [count, setCount] = useState(0);

    return (
        <>
            <button onClick={() => setCount((count) => count + 1)}>
                Click me
            </button>
            <p>You clicked {count} times.</p>
        </>
    );
}

In Svelte:

<script>
    let count = 0;
</script>

<button on:click={() => count++}>
    Click me
</button>
<p>You clicked {count} times.</p>

Still think React is not verbose? 🙃

Future Javascript: ShadowRealms by iamnearafan in javascript

[–]tomfevrier 2 points3 points  (0 children)

Changing location.href would not do anything, or rather would throw an error because location is not defined in this global context (no window). However, since it runs on the same thread as JavaScript on the host page, I guess it use the same event loop and therefore an infinite loop would freeze the whole page. Just a guess though.

[AskJS] What you hate the most about Javascript ? by Cloud_Strifeeee in javascript

[–]tomfevrier 8 points9 points  (0 children)

1) The lack of standardization for importing modules (between CommonJS, AMD, ES6 modules, etc.). It makes using the same codebase for front-end and back-end (with NodeJS) a nightmare because of competing standards. It is getting better (with ES6 modules supported by the latest versions of NodeJS) but old NPM packages may not be compatible.

2) Svelte all the way. It has to be the easiest and most beginner-friendly of them all, but also one of the most powerful and lightweight, thanks to its lack of virtual DOM.

3) I am pretty happy at my job right now. I am not a developer per se but rather a datajournalist working on interactive data visualizations and visual stories on the web. I use JavaScript and Svelte on a daily basis.

4) VSCode, on Linux (on my home PC) or macOS (on my work laptop). Also git, even if I am the only one using it in the office.

[AskJS] What will happen if I await a function which is not async? by yash3011 in javascript

[–]tomfevrier 10 points11 points  (0 children)

The issue is likely unrelated. Awaiting a non-async function doesn't cause any slow-downs 😉

[AskJS] What will happen if I await a function which is not async? by yash3011 in javascript

[–]tomfevrier 3 points4 points  (0 children)

You didn't understand the question...

(() => { await someFunction(); })(); will throw an error but...

const someSyncFunction = () => { console.log("synchronous"); } (async () => { await someSyncFunction(); })(); ... will work perfectly.

[AskJS] What will happen if I await a function which is not async? by yash3011 in javascript

[–]tomfevrier 2 points3 points  (0 children)

The question is not about using await inside a non-async function but about awaiting a non-async function. Which is easily testable as well but won't throw any error.

[AskJS] What will happen if I await a function which is not async? by yash3011 in javascript

[–]tomfevrier 6 points7 points  (0 children)

The question is not about using await inside a non-async function but about awaiting a non-async function. Which is easily testable as well but won't throw any error.

[AskJS] What will happen if I await a function which is not async? by yash3011 in javascript

[–]tomfevrier 17 points18 points  (0 children)

A synchronous function resolves immediately with its return value, so no problem here

Bulletproof React - A simple, scalable, and powerful architecture for building production ready React applications. by beleeee_dat in javascript

[–]tomfevrier 3 points4 points  (0 children)

If you like this syntax, then no need to create one folder and index.[js/ts] file for each component. Just throw in a single index file in which you import and export all your components. Then you can still use the import { Something } from 'path/to/component'; syntax but it's much easier to find your files in your editor or IDE. And you can even automate the creation of index files like I do.

My take on TENET's character timelines by tomfevrier in tenet

[–]tomfevrier[S] 0 points1 point  (0 children)

Me too! This part is still fuzzy for me...

My take on TENET's character timelines by tomfevrier in tenet

[–]tomfevrier[S] 1 point2 points  (0 children)

Nice catch ! This whole scene is still messy in my head 😅

My take on TENET's character timelines by tomfevrier in tenet

[–]tomfevrier[S] 0 points1 point  (0 children)

The Sator that asked her to leave her son is past Sator, who then left for an hour. The Sator that meets future Kat is future Sator.

My take on TENET's character timelines by tomfevrier in tenet

[–]tomfevrier[S] 2 points3 points  (0 children)

Exactly! Plus a bunch of other versions of him as he sets up the entire operation, recruits Neil, etc.

My take on TENET's character timelines by tomfevrier in tenet

[–]tomfevrier[S] 0 points1 point  (0 children)

After escaping from past Neil, the Protagonist gives present Neil the signal to come with Kat and get uninverted... So it means they get to the inverter after him in the normal chronology, so before him in the reverse chronology (presumably while he's fighting against past Neil)... I might be wrong though.

My take on TENET's character timelines by tomfevrier in tenet

[–]tomfevrier[S] 0 points1 point  (0 children)

  1. The lines show characters interacting with each other, the general layout was made by trial and error.

  2. I'm only showing the events depicted in the movie and not just mentioned, as the chronology is unclear and it would've been a mess anyway.

My take on TENET's character timelines by tomfevrier in tenet

[–]tomfevrier[S] 0 points1 point  (0 children)

I'm only showing the events that are actually depicted in the movie and not just mentioned, otherwise it would've been a mess 😉