Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/community/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Node.js has a dedicated [repository on GitHub](https://github.com/nodejs/help) t
### Real-time Chat
For real-time chat about Node.js development use the [OpenJS Foundation Slack](https://slack-invite.openjsf.org/) or IRC
For Slack, join the OpenJSF workspace and then join the [#nodejs](https://openjs-foundation.slack.com/archives/CK9Q4MB53) channel or [Node.js Slackers](https://www.nodeslackers.com/)
For IRC, go to irc.freenode.net in the #node.js channel with an [IRC client](https://en.wikipedia.org/wiki/Comparison_of_Internet_Relay_Chat_clients) or connect in your web browser to the channel using [freenode's WebChat](https://webchat.freenode.net/#node.js).
For IRC, go to irc.freenode.net in the #Node.js channel with an [IRC client](https://en.wikipedia.org/wiki/Comparison_of_Internet_Relay_Chat_clients) or connect in your web browser to the channel using [freenode's WebChat](https://webchat.freenode.net/#node.js).

### Stack Overflow

Expand Down
6 changes: 6 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ require('dotenv').config();
const config = require('./src/config');

module.exports = {
flags: {
DEV_SSR: false,
FAST_DEV: false,
PRESERVE_WEBPACK_CACHE: false,
PARALLEL_SOURCING: false,
},
pathPrefix: process.env.PATH_PREFIX,
siteMetadata: {
title: config.title,
Expand Down
42,650 changes: 16,832 additions & 25,818 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@
"color-string": "^1.5.3",
"dompurify": "2.0.17",
"dotenv": "^8.2.0",
"gatsby": "2.24.85",
"gatsby-plugin-canonical-urls": "^2.2.3",
"gatsby-plugin-catch-links": "^2.2.1",
"gatsby-plugin-manifest": "^2.4.0",
"gatsby-plugin-mdx": "^1.2.40",
"gatsby": "^3.1.1",
"gatsby-plugin-canonical-urls": "3.1.0",
"gatsby-plugin-catch-links": "3.1.0",
"gatsby-plugin-manifest": "3.1.0",
"gatsby-plugin-mdx": "2.1.0",
"gatsby-plugin-meta-redirect": "^1.1.1",
"gatsby-plugin-offline": "^3.1.2",
"gatsby-plugin-react-helmet": "^3.2.4",
"gatsby-plugin-sass": "2.3.1",
"gatsby-plugin-sharp": "2.6.36",
"gatsby-plugin-sitemap": "^2.0.5",
"gatsby-plugin-typescript": "^2.3.5",
"gatsby-remark-autolink-headers": "^2.2.1",
"gatsby-remark-copy-linked-files": "^2.10.0",
"gatsby-remark-images": "^3.2.2",
"gatsby-remark-prismjs": "^3.5.0",
"gatsby-source-filesystem": "^2.2.5",
"gatsby-transformer-remark": "^2.8.5",
"gatsby-plugin-offline": "4.1.0",
"gatsby-plugin-react-helmet": "4.1.0",
"gatsby-plugin-sass": "4.1.0",
"gatsby-plugin-sharp": "3.1.0",
"gatsby-plugin-sitemap": "3.1.0",
"gatsby-plugin-typescript": "3.1.0",
"gatsby-remark-autolink-headers": "3.1.0",
"gatsby-remark-copy-linked-files": "3.1.0",
"gatsby-remark-images": "4.1.0",
"gatsby-remark-prismjs": "4.1.0",
"gatsby-source-filesystem": "3.1.0",
"gatsby-transformer-remark": "3.1.0",
"intersection-observer": "^0.10.0",
"prismjs": "^1.21.0",
"react": "^16.13.1",
Expand Down
18 changes: 7 additions & 11 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ import { Link } from 'gatsby';
import React, { KeyboardEvent } from 'react';
import logoLight from '../../images/logos/nodejs-logo-light-mode.svg';
import logoDark from '../../images/logos/nodejs-logo-dark-mode.svg';
import defaultDarkModeController from '../../util/darkModeController';
// import defaultDarkModeController from '../../util/darkModeController';
import { useMediaQuery } from '../../hooks/useMediaQuery';

interface Props {
darkModeController?: typeof defaultDarkModeController;
}

const Header = ({
darkModeController = defaultDarkModeController,
}: Props): JSX.Element => {
const Header = (): JSX.Element => {
const isMobile = useMediaQuery('(max-width: 870px)');

const keyPressDarkModeHandler: (
e: KeyboardEvent<HTMLButtonElement>
) => void = e => {
if (e.charCode === 13 || e.charCode === 32) darkModeController.toggle();
// eslint-disable-next-line no-empty
if (e.charCode === 13 || e.charCode === 32) {
}
};

return (
Expand Down Expand Up @@ -90,8 +86,8 @@ const Header = ({
type="button"
className="dark-mode-toggle"
onKeyPress={keyPressDarkModeHandler}
onMouseDown={darkModeController.handleEvent}
onMouseUp={darkModeController.handleEvent}
// onMouseDown={darkModeController.handleEvent}
// onMouseUp={darkModeController.handleEvent}
>
<span className="sr-only">Toggle Dark Mode</span>
<i className="material-icons light-mode-only">nights_stay</i>
Expand Down
2 changes: 1 addition & 1 deletion src/documentation/0001-node-introduction/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Node.js is an open-source and cross-platform JavaScript runtime environment. It

Node.js runs the V8 JavaScript engine, the core of Google Chrome, outside of the browser. This allows Node.js to be very performant.

A Node.js app is run in a single process, without creating a new thread for every request. Node.js provides a set of asynchronous I/O primitives in its standard library that prevent JavaScript code from blocking and generally, libraries in Node.js are written using non-blocking paradigms, making blocking behavior the exception rather than the norm.
A Node.js app runs in a single process, without creating a new thread for every request. Node.js provides a set of asynchronous I/O primitives in its standard library that prevent JavaScript code from blocking and generally, libraries in Node.js are written using non-blocking paradigms, making blocking behavior the exception rather than the norm.

When Node.js performs an I/O operation, like reading from the network, accessing a database or the filesystem, instead of blocking the thread and wasting CPU cycles waiting, Node.js will resume the operations when the response comes back.

Expand Down
9 changes: 6 additions & 3 deletions src/documentation/0056-node-with-typescript/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ We can talk about other TypeScript benefits later, let's see some examples now!

Take a look at this code snippet and then we can unpack it together:

```ts
<!-- figure out why ts doesnt work here -->
```js
type User = {
name: string;
age: number;
Expand Down Expand Up @@ -60,7 +61,8 @@ Now when we know how to compile and run TypeScript code let's see TypeScript bug

This is how we will modify our code:

```ts
<!-- figure out why ts doesnt work here -->
```js
type User = {
name: string;
age: number;
Expand All @@ -80,7 +82,8 @@ const isJustineAnAdult: string = isAdult(justine, "I shouldn't be here!");

And this is what TypeScript has to say about this:

```ts
<!-- figure out why ts doesnt work here -->
```js
example.ts:12:3 - error TS2322: Type 'string' is not assignable to type 'number'.

12 age: "Secret!",
Expand Down
30 changes: 15 additions & 15 deletions src/util/darkModeController.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import { DarkModeController } from '@smotaal.io/dark-mode-controller/commonjs';
// import React from 'react';
// import { DarkModeController } from '@smotaal.io/dark-mode-controller/commonjs';

export interface ReactDarkModeController extends DarkModeController {
onPointerDown(
event: React.PointerEvent | React.MouseEvent | PointerEvent
): void;
onPointerUp(
event: React.PointerEvent | React.MouseEvent | PointerEvent
): void;
handleEvent(event?: React.PointerEvent | React.MouseEvent | Event): void;
}
// export interface ReactDarkModeController extends DarkModeController {
// onPointerDown(
// event: React.PointerEvent | React.MouseEvent | PointerEvent
// ): void;
// onPointerUp(
// event: React.PointerEvent | React.MouseEvent | PointerEvent
// ): void;
// handleEvent(event?: React.PointerEvent | React.MouseEvent | Event): void;
// }

// TODO: Figure out a way around HRM glitching (tackled upstream)
// SEE: https://github.com/SMotaal/meta/issues/7
// // TODO: Figure out a way around HRM glitching (tackled upstream)
// // SEE: https://github.com/SMotaal/meta/issues/7

// We're exporting a singleton
export default new DarkModeController() as ReactDarkModeController;
// // We're exporting a singleton
// export default new DarkModeController() as ReactDarkModeController;
29 changes: 16 additions & 13 deletions src/util/konami.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,23 @@ if (typeof window !== `undefined`) {
let buffer = '';
let lastDate = Date.now();

document.addEventListener('keyup', function triggerKonami({
keyCode,
}): void {
if (!VALID_KEYS.has(keyCode)) {
return;
document.addEventListener(
'keyup',
function triggerKonami({ keyCode }): void {
if (!VALID_KEYS.has(keyCode)) {
return;
}
buffer = `${
Date.now() - lastDate >= MAX_DELAY ? '' : buffer
}${keyCode}`;
lastDate = Date.now();
if (!contains(buffer, CODE_SEQUENCE)) {
return;
}
document.dispatchEvent(KONAMI_EVENT);
buffer = '';
}
buffer = `${Date.now() - lastDate >= MAX_DELAY ? '' : buffer}${keyCode}`;
lastDate = Date.now();
if (!contains(buffer, CODE_SEQUENCE)) {
return;
}
document.dispatchEvent(KONAMI_EVENT);
buffer = '';
});
);
})();

let discoMode: NodeJS.Timeout | null = null;
Expand Down