@webqit/observer 2.1.0 → 2.1.1

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.
Files changed (2) hide show
  1. package/README.md +30 -21
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -6,23 +6,27 @@
6
6
 
7
7
  <!-- /BADGES -->
8
8
 
9
- # Overview
9
+ A web-native object observability API!
10
+
11
+ Observe and intercept operations on any type of JavaScript objects and arrays, using a notably lightweight and predictable utility-first reactivity API!
12
+
13
+ ## Motivation
14
+
10
15
 
11
- > **Note**
12
- > <br>This is documentation for `Observer@2.x`. (Looking for [`Observer@1.x`](https://github.com/webqit/observer/tree/v1.7.6)?)
13
16
 
14
17
  ## Table of Contents
15
18
 
19
+ + [Motivation](#motivation)
16
20
  + [Download Options](#download-options)
17
- + [Overview](#overview)
18
- + [Method: `Observer.observe()`](#method-observerobserve)
19
- + [Concept: *Observers*](#concept-observers)
20
- + [Concept: *Mutations*](#concept-mutations)
21
- + [Concept: *Batch Mutations*](#concept-batch-mutations)
22
- + [Concept: *Custom Details*](#concept-custom-details)
23
- + [Concept: *Diffing*](#concept-diffing)
24
- + [Method: `Observer.intercept()`](#method-observerintercept)
25
- + [Concept: *Traps*](#concept-traps)
21
+ + [An Overview](#an-overview)
22
+ + [Method: `Observer.observe()`](#method-observerobserve)
23
+ + [Concept: *Observers*](#concept-observers)
24
+ + [Concept: *Mutations*](#concept-mutations)
25
+ + [Concept: *Batch Mutations*](#concept-batch-mutations)
26
+ + [Concept: *Custom Details*](#concept-custom-details)
27
+ + [Concept: *Diffing*](#concept-diffing)
28
+ + [Method: `Observer.intercept()`](#method-observerintercept)
29
+ + [Concept: *Traps*](#concept-traps)
26
30
  + [Issues](#issues)
27
31
  + [License](#license)
28
32
 
@@ -50,7 +54,12 @@ import Observer from '@webqit/observer';;
50
54
  const Observer = window.webqit.Observer;
51
55
  ```
52
56
 
53
- ## Method: `Observer.observe()`
57
+ ## An Overview
58
+
59
+ > **Note**
60
+ > <br>This is documentation for `Observer@2.x`. (Looking for [`Observer@1.x`](https://github.com/webqit/observer/tree/v1.7.6)?)
61
+
62
+ ### Method: `Observer.observe()`
54
63
 
55
64
  Observe mutations on any object or array!
56
65
 
@@ -64,7 +73,7 @@ Observer.observe( obj, callback[, options = {} ]);
64
73
  Observer.observe( obj, props, callback[, options = {} ]);
65
74
  ```
66
75
 
67
- ### Concept: *Observers*
76
+ #### Concept: *Observers*
68
77
 
69
78
  Observe arbitrary objects and arrays:
70
79
 
@@ -115,7 +124,7 @@ Observer.observe( obj, mutations => {
115
124
  abortController.abort();
116
125
  ```
117
126
 
118
- ### Concept: *Mutations*
127
+ #### Concept: *Mutations*
119
128
 
120
129
  Programmatically mutate properties of an object using the *[Reflect](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect#static_methods)-like* set of operators; each operation will be reported by observers:
121
130
 
@@ -233,7 +242,7 @@ _obj.prop1 = 'value1';
233
242
  Observer.set( _obj, 'prop1', 'value1' );
234
243
  ```
235
244
 
236
- **-->** "Restore" accessorized properties to normal by calling `unaccessorize()`:
245
+ **-->** "Restore" accessorized properties to their normal state by using the `unaccessorize()` method:
237
246
 
238
247
  ```js
239
248
  Observer.unaccessorize( obj, [ 'prop1', 'prop6', 'prop10' ] );
@@ -245,7 +254,7 @@ Observer.unaccessorize( obj, [ 'prop1', 'prop6', 'prop10' ] );
245
254
  obj = Observer.unproxy( _obj );
246
255
  ```
247
256
 
248
- ### Concept: *Batch Mutations*
257
+ #### Concept: *Batch Mutations*
249
258
 
250
259
  Make multiple mutations at a go, and they'll be correctly delivered in batch to observers!
251
260
 
@@ -288,7 +297,7 @@ Observer.batch( arr, async () => {
288
297
 
289
298
  > Method calls on a proxied instance - e.g. `Object.proxy( arr ).splice( 0 )` - also follow this strategy.
290
299
 
291
- ### Concept: *Custom Details*
300
+ #### Concept: *Custom Details*
292
301
 
293
302
  Pass some custom detail - an arbitrary value - to observers via a `params.detail` property.
294
303
 
@@ -309,7 +318,7 @@ Observer.observe( obj, 'prop1', mutation => {
309
318
  } );
310
319
  ```
311
320
 
312
- ### Concept: *Diffing*
321
+ #### Concept: *Diffing*
313
322
 
314
323
  Receive notifications only for mutations that actually change property state, and ignore those that don't.
315
324
 
@@ -334,7 +343,7 @@ descripted
334
343
  namespace
335
344
  -->
336
345
 
337
- ## Method: `Observer.intercept()`
346
+ ### Method: `Observer.intercept()`
338
347
 
339
348
  Intercept operations on any object or array before they happen!
340
349
 
@@ -348,7 +357,7 @@ Observer.intercept( obj, prop, handler[, options = {} ]);
348
357
  Observer.intercept( obj, traps[, options = {} ]);
349
358
  ```
350
359
 
351
- ### Concept: *Traps*
360
+ #### Concept: *Traps*
352
361
 
353
362
  Extend standard operations on an object - `Observer.set()`, `Observer.deleteProperty()`, etc - with custom traps using the [`Observer.intercept()`](https://webqit.io/tooling/observer/docs/api/reactions/intercept) method!
354
363
 
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "events"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/observer",
15
- "version": "2.1.0",
15
+ "version": "2.1.1",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",