Last Sync: 2022-07-16 10:30:04

This commit is contained in:
tactonbishop 2022-07-16 10:30:04 +01:00
parent 2a50bdcc51
commit a724ac5d8f
5 changed files with 20 additions and 15 deletions

View file

@ -69,4 +69,8 @@ The phases are as follows:
* This phase can be targetted via the `process.exit()` function or the close event of a web-socket.
https://heynode.com/tutorial/how-event-loop-works-nodejs/
## Event _loop_ and event _queue_
The terms _event loop_ and _event queue_ are often used interchangeably in the literature but in fact they are distinct.
The Event Loop is the Node runtime's method of execution, the queue is the stack of tasks that are lined up and executed by the loop. We can think of the queue as being the input and the loop as what acts on the input. The queue obviously emerges from the program we write but it is scheduled, organised and sequenced by the loop.

View file

@ -5,8 +5,8 @@ tags:
- node-js
---
# Global object
>
> In Node every function and variable should be scoped to a module. We should not define functions and variables within the global scope.
* In Node the equivalent to the browser's `Window` object is `global`. The properties and methods that belong to this method are available anywhere in a program.

View file

@ -6,13 +6,13 @@ tags:
- npm
---
# Package management
## List installed packages
````
```bash
npm list
````
This will return a recursive tree that lists dependencies of dependencies, ...
```
This will return a recursive tree that lists dependencies, dependences of dependencies, ... and so on.
To limit the depth you can add the `--depth=` flag. For example to see only your installed packages and their versions use `npm list --depth=0`.
## View `package.json` data for an installed package
@ -24,7 +24,9 @@ We can pinpoint specific dependencies in the `package.json`, e.g. `npm view [pac
## View outdated modules
See whether your dependency version is out of date use `npm outdated`. This gives us a table, for example:
![Pasted image 20220411082627.png](../../img/Pasted%20image%2020220411082627.png)
![Pasted image 20220411082627.png](/img/Pasted_image_20220411082627.png)
* *Latest* tells us the latest release available from the developers
* *Wanted* tells us the version that our `package.json` rules target. To take the first dependency as an example. We must have set our SemVer syntax to `^0.4.x` since it is telling us that there is a minor release that is more recent than the one we have installed but is not advising that we update to the latest major release.
@ -32,4 +34,4 @@ See whether your dependency version is out of date use `npm outdated`. This give
## Updating
`npm update` only updates from *current* to *wanted*. In other words it only updates in accordance with your caret and tilde rules applied to semantic versioning.
`npm update` only updates from *current* to *wanted*. In other words it only updates in accordance with your caret and tilde rules applied to [semantic versioning](/Software_Engineering/Semantic_versioning.md).

View file

@ -24,6 +24,7 @@ console.log("Bye");
2. Goes to the definition of this function (`function greet(who)...`)
3. Executes the `console.log` within this function
4. Returns to the location that called it (`greet("Harry")`)
5. Finds that there is nothing else to do in this function so moves to next function: the `console.log("bye")
5. Finds that there is nothing else to do in this function so moves to next function: the `console.log("bye")`
6. Executes
7. Returns to line that called it. Finds nothing else to do. Exits program
7. Returns to line that called it. Finds nothing else to do. Exits program.

View file

@ -2,13 +2,11 @@
tags:
- Software_Engineering
---
# Semantic versioning
````
```
3.4.1 === major.minor.patch
````
```
* Major