| 876 | // to rewrite all the logic in this file to accomodate both |
| 877 | // types of definitions. |
| 878 | function createLegacyDefinitionAdapter(defn) { |
| 879 | var result = { |
| 880 | name: defn.name, |
| 881 | type: defn.type, |
| 882 | initialize: function(el, width, height) { |
| 883 | return defn.factory(el, width, height); |
| 884 | }, |
| 885 | renderValue: function(el, x, instance) { |
| 886 | return instance.renderValue(x); |
| 887 | }, |
| 888 | resize: function(el, width, height, instance) { |
| 889 | return instance.resize(width, height); |
| 890 | } |
| 891 | }; |
| 892 | |
| 893 | if (defn.find) |
| 894 | result.find = defn.find; |
| 895 | if (defn.renderError) |
| 896 | result.renderError = defn.renderError; |
| 897 | if (defn.clearError) |
| 898 | result.clearError = defn.clearError; |
| 899 | |
| 900 | return result; |
| 901 | } |
| 902 | })(); |
| 903 | |