@divkitframework/divkit 3.0.1 → 4.0.0-patched-7b07a09d20ca3e6423f0d696d8030fee2b2d3ba4

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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ## DivKit for the Web
2
2
 
3
+ ![client code size](https://img.shields.io/badge/client%20lib%20minified&brotli-47.7%20KB-brightgreen)
4
+
3
5
  ### Installation
4
6
 
5
7
  ```
@@ -137,6 +139,12 @@ ES modules can be used in the browser directly without any build:
137
139
  </script>
138
140
  ```
139
141
 
142
+ ### Usage with React
143
+
144
+ There is a separate package for that.
145
+
146
+ [React component package](../divkit-react)
147
+
140
148
  ### TypeScript and types
141
149
 
142
150
  All modules have typescript definitions (client, client-hydratable and server), so typescript will load them at any use.
@@ -155,7 +163,7 @@ Node.js
155
163
  Node.js >= 8
156
164
  ```
157
165
 
158
- ### API
166
+ ### API: render
159
167
 
160
168
  All 3 exported modules have an exported function `render`. This function works in a similar way on client and server.
161
169
 
@@ -163,8 +171,6 @@ All 3 exported modules have an exported function `render`. This function works i
163
171
 
164
172
  Instead, `/server` module will return an HTML string.
165
173
 
166
- ### Options
167
-
168
174
  #### id
169
175
 
170
176
  String, required.
@@ -280,3 +286,38 @@ Divjson along with the `card` and `templates` can contain a `palette` property w
280
286
  }
281
287
  }
282
288
  ```
289
+
290
+ ### API: other
291
+
292
+ #### Variables
293
+
294
+ ```js
295
+ import {createVariable, createGlobalVariablesController, render} from '@divkit/divkit';
296
+
297
+ // Custom variable outside of DivJson
298
+ const variable = createVariable('name', 'string', 'val');
299
+
300
+ variable.subscribe(newVal => {
301
+ console.log(newVal);
302
+ });
303
+
304
+ // Custom scope for variables
305
+ const controller = createGlobalVariablesController();
306
+
307
+ controller.setVariable(variable);
308
+
309
+ render(({
310
+ id: 'smth',
311
+ target: document.querySelector('#root'),
312
+ json: {},
313
+ globalVariablesController: controller
314
+ });
315
+ ```
316
+
317
+ ---
318
+
319
+ [Documentation](https://divkit.tech/doc). [Medium tutorial](https://medium.com/p/cad519252f0f). [Habr tutorial](https://habr.com/ru/company/yandex/blog/683886/).
320
+
321
+ Telegram: [News](https://t.me/divkit_news) | [English-speaking chat](https://t.me/divkit_community_en) | [Чат на русском](https://t.me/divkit_community_ru).
322
+
323
+ [Twitter](https://twitter.com/DivKitFramework)