1- <div class =" row w-100 " >
2- <div class =" col-12 text-center " >
1+ <p >
2+ <img src =" logo/logo-432x260.png " alt =" data-context logo " width =" 440 " style =" background-color :#333 ;border-radius :4em ;border-color : #999 ;border-width : 0.5em ;border-style : dashed ;" >
3+ </p >
34
45# data-context
56
6- Watch data changes in the browser and node.js<br >
7- This manual is also available in [ HTML5] ( https://manuel-lohmus.github.io/data-context/README.html ) .<br >
8-
9- </div >
10- </div >
11- <div class =" row w-100 " >
12- <div class =" col-lg-3 d-lg-inline " >
13- <div class =" sticky-top overflow-auto vh-lg-100 " >
14- <div id =" list-headers " class =" list-group mt-2 ms-lg-2 ms-4 " >
15-
16- #### Table of contents
17- - [ ** Introduction** ] ( #introduction )
18- - [ ** Features** ] ( #features )
19- - [ ** Installation** ] ( #installation )
20- - [ ** Testing** ] ( #testing )
21- - [ ** Usage** ] ( #usage )
22- - [ nodejs example] ( #nodejs-example )
23- - [ browser example] ( #browser-example )
24- - [ ** References** ] ( #references )
25- - [ createDataContext(data, propertyName, parent)] ( #createdatacontextdata-propertyname-parent )
26- - [ DataContext] ( #datacontext )
27- - [ EventListener(event)] ( #eventlistenerevent )
28- - [ EventObject] ( #eventobject )
29- - [ PropertyName] ( #propertyname )
30- - [ Reviver] ( #reviver )
31- - [ ** License** ] ( #license )
32-
33- </div >
34- </div >
35- </div >
36-
37- <div class =" col-lg-9 mt-2 " >
38- <div class =" ps-4 markdown-body " data-bs-spy =" scroll " data-bs-target =" #list-headers " data-bs-offset =" 0 " tabindex =" 0 " >
39-
40-
41- ## Introduction
7+ Watch data changes in the browser and node.js
8+
9+ ## 📚 Table of contents
10+
11+ - [ ✨ Features] ( #-features )
12+ - [ 📋 Description] ( #-description )
13+ - [ 📦 Installation] ( #-installation )
14+ - [ 🧪 Testing] ( #-testing )
15+ - [ 🚀 Usage] ( #-usage )
16+ - [ 📖 API Reference] ( #-api-reference )
17+ - [ 📜 License] ( #-license )
18+
19+ <p align =" right " ><a href =" #data-context " >Back to top ↑</a ></p >
20+
21+ ---
22+
23+ ## ✨ Features
24+
25+ - Create a context from the data.
26+ - Listen for change events.
27+ - Update the context.
28+ - Parse JSON data to the context.
29+ - Stringify changes to JSON.
30+ - Used extended JSON data format. Metadata and comments are supported.
31+
32+ <p align =" right " ><a href =" #data-context " >Back to top ↑</a ></p >
33+
34+ ---
35+
36+ ## 📋 Description
37+
38+ The 'data-context' module provides a way to create a data context that can watch for changes in the data.
4239
4340It is a simple and easy-to-use library that can be used in the browser or in node.js.
4441You can create a context from the data, then listen for change events and stringify changes.
@@ -104,28 +101,38 @@ Here are some potential use cases:
104101 - ** Description** : Handle incremental updates to JSON data, including metadata and comments.
105102 - ** Example** : Use the library to parse, modify, and serialize JSON data with support for incremental updates and metadata.
106103
107- ## Features
104+ < p align = " right " >< a href = " #data-context " >Back to top ↑</ a ></ p >
108105
109- - Create a context from the data.
110- - Listen for change events.
111- - Update the context.
112- - Parse JSON data to the context.
113- - Stringify changes to JSON.
114- - Used extended JSON data format. Metadata and comments are supported.
106+ ---
107+
108+ ## 📦 Installation
115109
116- ## Installation
110+ [ Available on npm ] ( https://www.npmjs.com/package/data-context )
117111
118112### nodejs:
119- ` npm install data-context `
113+ ``` bash
114+ npm install data-context
115+ ```
120116
121117### browser:
122- ` <script src="https://cdn.jsdelivr.net/npm/data-context@2" ></script> `
118+ or use CDN (for an HTML page hosted on the server):
119+ ``` html
120+ <script src =" ./node_modules/data-context/borwser.js" type =" text/javascript" ></script >
121+ ```
122+ or use CDN (for a standalone HTML page):
123+ ``` html
124+ <script src =" https://cdn.jsdelivr.net/npm/data-context" type =" text/javascript" ></script >
125+ ```
126+ or use 'tiny-https-server':
127+ ``` html
128+ <script async src =" node_modules/data-context@2" ></script >
129+ ```
123130
124- ### Using tiny-https-server router:
125- or use [ 'tiny-https-server'] ( https://www.npmjs.com/package/tiny-https-server ) router:
126- ` <script async src="node_modules/data-context@2"></script> `
131+ <p align =" right " ><a href =" #data-context " >Back to top ↑</a ></p >
127132
128- ## Testing
133+ ---
134+
135+ ## 🧪 Testing
129136
130137You can test ` data-context ` on your system using this command:
131138
@@ -139,7 +146,11 @@ or open in your browser:
139146
140147` ./node_modules/data-context/index.test.html `
141148
142- ## Usage
149+ <p align =" right " ><a href =" #data-context " >Back to top ↑</a ></p >
150+
151+ ---
152+
153+ ## 🚀 Usage
143154
144155### nodejs example:
145156``` javascript
@@ -335,7 +346,16 @@ intervalId = setInterval(() => {
335346</html >
336347```
337348
338- ## References
349+ ## 📖 API Reference
350+
351+ - [ createDataContext(data, propertyName, parent)] ( #createdatacontextdata-propertyname-parent )
352+ - [ DataContext] ( #datacontext )
353+ - [ EventListener(event)] ( #eventlistenerevent )
354+ - [ EventObject] ( #eventobject )
355+ - [ PropertyName] ( #propertyname )
356+ - [ Reviver] ( #reviver )
357+
358+ <p align =" right " ><a href =" #data-context " >Back to top ↑</a ></p >
339359
340360### * createDataContext(data, propertyName, parent)*
341361
@@ -357,6 +377,11 @@ Create a data context from the data.
357377- ` parse ` {(str: string, reviver?: [ Reviver] ( #reviver ) ) => [ DataContext] ( #datacontext ) } - Parse JSON string to the data context.
358378- ` stringify ` {(data: any, replacer?: Replacer, space?: number) => string} - Stringify the data to JSON string.
359379
380+ <p align =" right " ><a href =" #-api-reference " >Back to API Reference ↑</a ></p >
381+ <p align =" right " ><a href =" #data-context " >Back to top ↑</a ></p >
382+
383+ ---
384+
360385### * DataContext*
361386
362387The data context Proxy object.
@@ -382,6 +407,11 @@ The data context Proxy object.
382407- ` overwritingData ` {(text: string, reviver?: [ Reviver] ( #reviver ) ) => void} - Overwrite the data.
383408- ` stringifyChanges ` {(reviver?: [ Reviver] ( #reviver ) , space?: number|string, onlyModified?: boolean, setUnmodified?: boolean) => string} - Stringify the changes.
384409
410+ <p align =" right " ><a href =" #-api-reference " >Back to API Reference ↑</a ></p >
411+ <p align =" right " ><a href =" #data-context " >Back to top ↑</a ></p >
412+
413+ ---
414+
385415### * EventListener(event)*
386416
387417The event listener function.
@@ -394,6 +424,11 @@ The event listener function.
394424** Returns:**
395425- {boolean} - The flag that indicates that the listener is alive.
396426
427+ <p align =" right " ><a href =" #-api-reference " >Back to API Reference ↑</a ></p >
428+ <p align =" right " ><a href =" #data-context " >Back to top ↑</a ></p >
429+
430+ ---
431+
397432### * EventObject*
398433
399434The event object.
@@ -413,32 +448,39 @@ The event object.
413448- ` oldValue ` {any} - The old value.
414449- ` newValue ` {any} - The new value.
415450
451+ <p align =" right " ><a href =" #-api-reference " >Back to API Reference ↑</a ></p >
452+ <p align =" right " ><a href =" #data-context " >Back to top ↑</a ></p >
453+
454+ ---
455+
416456### * PropertyName*
417457
418458The property name.
419459
420460** Type:** ` string `
421461
462+ <p align =" right " ><a href =" #-api-reference " >Back to API Reference ↑</a ></p >
463+ <p align =" right " ><a href =" #data-context " >Back to top ↑</a ></p >
464+
465+ ---
466+
422467### * Reviver*
423468
424469The reviver function.
425470
426471** Type:** [ ` reviver ` ] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#reviver )
427472or [ ` createDataContext ` ] ( #createdatacontextdata-propertyname-parent ) or ` null `
428473
429- ## License
474+ <p align =" right " ><a href =" #-api-reference " >Back to API Reference ↑</a ></p >
475+ <p align =" right " ><a href =" #data-context " >Back to top ↑</a ></p >
430476
431- This project is licensed under the MIT License.
477+ ---
432478
433- Copyright & copy ; Manuel Lõhmus
479+ ## 📜 License
434480
435- [ ![ Donate] ( https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif )] ( https://www.paypal.com/donate?hosted_button_id=TMZURGNWWYUBW )
481+ This project is licensed under the MIT License.<br >
482+ Copyright © ; Manuel Lõhmus
436483
437- Donations are welcome and will go towards further development of this project.
484+ < p align = " right " >< a href = " #data-context " >Back to top ↑</ a ></ p >
438485
439- <br >
440- <br >
441- <br >
442- </div >
443- </div >
444- </div >
486+ ---
0 commit comments