muu

DEPRECATED lightweight JS framework
git clone https://git.ce9e.org/muu.git

commit
63384115630200abc02713ac0fdf0592bf4b3860
parent
f6f74f514a107581e0d7f3f356fc257276117636
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2016-01-24 17:49
define events on registry

Diffstat

M src/muu-directive.js 2 +-
M src/muu-registry.js 3 ++-
M test/test-directive.js 3 ++-

3 files changed, 5 insertions, 3 deletions


diff --git a/src/muu-directive.js b/src/muu-directive.js

@@ -59,7 +59,7 @@ define('muu-directive', ['muu-dom-helpers', 'muu-js-helpers'], function($, _) {
   59    59         this.update = function(data) {
   60    60             registry.updateDOM(root, registry.renderer(template, data));
   61    61 
   62    -1             _.forEach(['keydown', 'keyup', 'click', 'change', 'search'], function(eventType) {
   -1    62             _.forEach(registry.events, function(eventType) {
   63    63                 var selector = '[data-on' + eventType + ']';
   64    64                 _.forEach(self.querySelectorAll(selector), function(element) {
   65    65                     element.addEventListener(eventType, eventCallback, false);

diff --git a/src/muu-registry.js b/src/muu-registry.js

@@ -24,7 +24,8 @@ define('muu-registry', ['muu-template', 'muu-update-dom', 'muu-directive', 'muu-
   24    24 
   25    25         this.config = config || {};
   26    26         this.renderer = self.config.renderer || muuTemplate;
   27    -1         this.updateDOM = self.config.updateDOM || muuUpdateDOM
   -1    27         this.updateDOM = self.config.updateDOM || muuUpdateDOM;
   -1    28         this.events = ['keydown', 'keyup', 'click', 'change', 'search'];
   28    29 
   29    30         /**
   30    31          * Register a new type of {@link Directive}

diff --git a/test/test-directive.js b/test/test-directive.js

@@ -11,7 +11,8 @@ define(['muu-directive', 'muu-update-dom', 'muu-js-helpers', 'muu-dom-helpers'],
   11    11                 renderer: sinon.spy(function(template) {
   12    12                     return template;
   13    13                 }),
   14    -1                 updateDOM: updateDOM
   -1    14                 updateDOM: updateDOM,
   -1    15                 events: ['keydown', 'keyup', 'click', 'change', 'search'],
   15    16             };
   16    17         });
   17    18