diff --git a/archive/v0.1.21/getting-started.html b/archive/v0.1.21/getting-started.html index 8278fb28..c90962e8 100644 --- a/archive/v0.1.21/getting-started.html +++ b/archive/v0.1.21/getting-started.html @@ -362,13 +362,19 @@ m.module(document, todo);
this.description = m.prop(data.description)
becomes:
//private store
-var description = data.description;
+var description;
//public getter-setter
this.description = function(value) {
if (arguments.length > 0) description = value.toUpperCase();
return description;
-}
+}
+
+//make it serializable
+this.description.toJSON = function() {return description}
+
+//set the value
+this.description(data.description)
According to Mithril's philosophy, list and description are also considered model-level entities. This is a subtle but important point: model entities don't need to be full-blown custom classes.
Native Javascript classes are quite appropriate for storing primitive and structured data. Since in this case they are indeed being used to store data - even if temporarily - they are model entities!
Be aware that by using the native Array class for a list, we're making an implicit statement that we are going to support all of the standard Array methods as part of our API.
diff --git a/archive/v0.1.21/mithril.min.zip b/archive/v0.1.21/mithril.min.zip index 1ed472c8..9b99d2ee 100644 Binary files a/archive/v0.1.21/mithril.min.zip and b/archive/v0.1.21/mithril.min.zip differ