cradova 2.0.0 → 2.1.0
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 +46 -2
- package/dist/index.d.ts +59 -640
- package/dist/index.js +379 -1494
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -132,6 +132,19 @@ function HelloMessage(name) {
|
|
|
132
132
|
return _("div", "Hello " + name);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
|
|
136
|
+
/*
|
|
137
|
+
|
|
138
|
+
when using router and screens
|
|
139
|
+
|
|
140
|
+
cradova will create a div with data-cra-id=cradova-app-wrapper
|
|
141
|
+
|
|
142
|
+
if it already exist cradova will use it instead
|
|
143
|
+
|
|
144
|
+
so if you want to use your own mount point then create a div with data-cra-id="cradova-app-wrapper"
|
|
145
|
+
|
|
146
|
+
*/
|
|
147
|
+
|
|
135
148
|
const home = new Screen({
|
|
136
149
|
name: "hello page", // page title
|
|
137
150
|
template: HelloMessage,
|
|
@@ -152,9 +165,9 @@ Router.route("/", home);
|
|
|
152
165
|
## State management
|
|
153
166
|
|
|
154
167
|
```js
|
|
155
|
-
// dispatch - global (element) requires state ID
|
|
156
168
|
|
|
157
|
-
|
|
169
|
+
|
|
170
|
+
// element can have this.updateState when the shouldUpdate props is true
|
|
158
171
|
|
|
159
172
|
// Ref components
|
|
160
173
|
|
|
@@ -209,6 +222,15 @@ const nameRef = new Ref(function ( name ) {
|
|
|
209
222
|
});
|
|
210
223
|
});
|
|
211
224
|
|
|
225
|
+
/*
|
|
226
|
+
cradova Ref are component objects
|
|
227
|
+
with methods for rendering, pre-rendering, and updating a it dom elements.
|
|
228
|
+
|
|
229
|
+
Ref also has the feature to stash input values need by the components
|
|
230
|
+
|
|
231
|
+
*/
|
|
232
|
+
|
|
233
|
+
|
|
212
234
|
function Home() {
|
|
213
235
|
return _("div.foo#bar",
|
|
214
236
|
counter,
|
|
@@ -224,6 +246,28 @@ const home = new Screen({
|
|
|
224
246
|
...
|
|
225
247
|
});
|
|
226
248
|
|
|
249
|
+
/*
|
|
250
|
+
|
|
251
|
+
Nice things about cradova screens
|
|
252
|
+
|
|
253
|
+
screens are rendered once by default to hack
|
|
254
|
+
responsiveness making your app work fast as user navigates.
|
|
255
|
+
|
|
256
|
+
this behavior can be override
|
|
257
|
+
by passing
|
|
258
|
+
prerender: false
|
|
259
|
+
in the constructor
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
Cradova screens has
|
|
263
|
+
onActivate() and
|
|
264
|
+
onDeactivate() methods
|
|
265
|
+
|
|
266
|
+
these allow you manage rendering
|
|
267
|
+
circle for each in your app
|
|
268
|
+
|
|
269
|
+
*/
|
|
270
|
+
|
|
227
271
|
Router.route("/", home);
|
|
228
272
|
```
|
|
229
273
|
|