Add a feature to use a Backbone.View as the rendering implementation.
Showing
3 changed files
with
19 additions
and
3 deletions
... | @@ -9,7 +9,23 @@ define(function(require) { | ... | @@ -9,7 +9,23 @@ define(function(require) { |
9 | binder[methodName].apply(binding, args); | 9 | binder[methodName].apply(binding, args); |
10 | }; | 10 | }; |
11 | 11 | ||
12 | var render = function() { | 12 | var render = function(el, cmd, errorList) { |
13 | var viewClassPath = module.config().viewClassPath; | ||
14 | if (viewClassPath) { | ||
15 | var $el = $(el); | ||
16 | var view = $el.data('error-view'); | ||
17 | if (view === undefined && cmd === 'bind') { | ||
18 | $el.data('error-view', null); | ||
19 | require([viewClassPath], function(ViewClass) { | ||
20 | $el.data('error-view', new ViewClass({el: el})); | ||
21 | }); | ||
22 | return; | ||
23 | } | ||
24 | if (view) { | ||
25 | view.errorCallback(cmd, errorList); | ||
26 | } | ||
27 | return; | ||
28 | } | ||
13 | var renderImpl = module.config().render; | 29 | var renderImpl = module.config().render; |
14 | if (renderImpl) { | 30 | if (renderImpl) { |
15 | return renderImpl.apply(this, arguments); | 31 | return renderImpl.apply(this, arguments); | ... | ... |
-
Please register or sign in to post a comment