OSDN Git Service

Merge pull request #29 from mtsgi/feature/kaf-data
[kit/kit.git] / system.js
index 8ca3969..bbd5a8c 100644 (file)
--- a/system.js
+++ b/system.js
@@ -1139,6 +1139,15 @@ const App = new function() {
         return App;
     }
 
+    this.d = new Object();
+
+    this.data = ( _pid, _name ) => {
+        let _r;
+        if( _name ) _r = App.d[_pid][_name];
+        else _r = App.d[_pid];
+        return _r;
+    }
+
     this.e = new Object();
 
     this.event = ( _pid, _name, _event ) => {
@@ -1179,6 +1188,10 @@ const App = new function() {
             if( i.hasAttribute("kit-html") ){
                 $(i).html( eval(i.getAttribute("kit-html")) );
             }
+            if( i.hasAttribute("kit-bind") ){
+                if( App.d[_pid] == undefined ) App.d[_pid] = new Object();
+                $(i).on("change", () => App.d[_pid][i.getAttribute("kit-bind")] = $(i).val() );
+            }
         }
     }