context 2.0.0-next-9f9b97 → 2.0.0-next-8ba989

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,13 +4,14 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## 2.0.0 - 2021-11-24
7
+ ## 2.0.0 - 2021-12-17
8
8
  ### Changed or removed
9
9
  - 7c43eab major(context): used named export in context (ealush)
10
10
  - e8652bc breaking(vest, enforce): prepare next major (ealush)
11
11
  - dab8e00 breaking(vest, enforce): prepare next major (ealush)
12
12
 
13
13
  ### Added
14
+ - b0a9a14 feat(vest): use key prop to retain test state after reorder (#732) (Evyatar)
14
15
  - 220127b added(n4s): partial rule modifier (undefined)
15
16
  - b5ce72d feat(n4s): context propagation within enforce (undefined)
16
17
 
package/README.md CHANGED
@@ -4,6 +4,7 @@ Simple utility for context propagation within Javascript applications and librar
4
4
  It allows you to keep reference for shared variables, and access them down in your function call even if not declared in the same scope.
5
5
 
6
6
  ## How Context Works?
7
+
7
8
  The way context works is quite simple. Creating a context initializes a closure with a context storage object. When you run your context call, it takes your values, and places them in the context storage object. When your function finishes running, the context is cleared.
8
9
 
9
10
  ![image](https://user-images.githubusercontent.com/11255103/137119151-6912d3f1-ab48-4c91-a426-76af8abc8c55.png)
@@ -125,13 +126,15 @@ Working with context inside within async code may lead to unexpected results whe
125
126
  This is known and expected behavior. Context is a synchronous context propagation tool that completely relies on the synchronous nature of function calls in JS - this is exactly what allows context to run.
126
127
 
127
128
  #### But my function is still running. Why did the context clear?
129
+
128
130
  The async parts of your function are actually not executed along with your sync code, and even though you "await" it, the browser carries on and allows other code to run in between instead of blocking execution until your async code is complete.
129
131
 
130
132
  #### Ok, so what do I do?
133
+
131
134
  There are multiple strategies of handling async functions with context.
132
135
 
133
136
  1. Pulling your values from context right before your async call
134
- This is the most obvious and easiest to achieve, though not always what you need. The basic idea is that you take whatever you need from the context when it is still available to you.
137
+ This is the most obvious and easiest to achieve, though not always what you need. The basic idea is that you take whatever you need from the context when it is still available to you.
135
138
 
136
139
  2. context.bind or context.run your async function to the context you extracted
137
- This is the next logical step - you have a function that you know should run later with your context. You can bind your context to it for delayed execution. When your function runs later down the line within your asynchronous code, internally it will still have access to whatever you bound to it.
140
+ This is the next logical step - you have a function that you know should run later with your context. You can bind your context to it for delayed execution. When your function runs later down the line within your asynchronous code, internally it will still have access to whatever you bound to it.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0-next-9f9b97",
2
+ "version": "2.0.0-next-8ba989",
3
3
  "license": "MIT",
4
4
  "main": "./dist/cjs/context.js",
5
5
  "types": "./types/context.d.ts",