Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add in convenience function for schema to check inheritance type of o…

…bject
  • Loading branch information...
commit ad0c6f7df0ea9a37f86e5636df40d4ec8857984a 1 parent 7776d5f
Rhys Brett-Bowen authored March 01, 2012
3  README.md
Source Rendered
@@ -69,6 +69,9 @@ mvc.Router uses goog.History and hash tokens to hold and manage the state of the
69 69
 #### v0.5 ####
70 70
 
71 71
 - add in format function on model
  72
+- removed dependency on goog.dom from mvc.Model
  73
+- put in convenience functions for binding elements with model attributes
  74
+- put in convenience function for schema test for type of object
72 75
 
73 76
 #### v0.4 ####
74 77
 
13  model.js
@@ -357,6 +357,19 @@ mvc.model.Schema.prototype.set = function(key, val) {
357 357
     }, this));
358 358
 };
359 359
 
  360
+mvc.model.Schema.Test = function(obj) {
  361
+    return function(val) {
  362
+        if(val.constructor == obj)
  363
+            return true;
  364
+        while(val.superClass_) {
  365
+            val = val.superClass_.constructor;
  366
+            if(val == obj)
  367
+                return true;
  368
+        }
  369
+        return false;
  370
+    };
  371
+}
  372
+
360 373
 mvc.model.Schema.prototype.validate = function(key, val) {
361 374
     if(key in this.schema_)
362 375
         return this.schema_[key](val);
2  sync/sync.js
... ...
@@ -1,5 +1,5 @@
1 1
 // v0.1
2  
-goog.provide('mvc.ync');
  2
+goog.provide('mvc.Sync');
3 3
 
4 4
 /**
5 5
  * @enum {number}
4  testApp/testApp.js
@@ -22,9 +22,7 @@ control.init = function() {
22 22
     var model = this.getModel();
23 23
     
24 24
     // bind model changes on text to update the text fields
25  
-    model.bind('text', this.getEls('.new_text'), function(el, val) {
26  
-            el.value = val;
27  
-    });
  25
+    model.bind('text', this.getEls('.new_text'), mvc.Control.Fn.VAL);
28 26
             
29 27
     this.delegateEvents({
30 28
         // when text is modified save to model then save to data storage

0 notes on commit ad0c6f7

Please sign in to comment.
Something went wrong with that request. Please try again.