Chromium Code Reviews| Index: ui/webui/resources/js/cr.js |
| diff --git a/ui/webui/resources/js/cr.js b/ui/webui/resources/js/cr.js |
| index 94c7553714cdc167a2c7bf87009f7416b80aae33..87d56111a09bad17866b19ccd769847ea1438bbd 100644 |
| --- a/ui/webui/resources/js/cr.js |
| +++ b/ui/webui/resources/js/cr.js |
| @@ -294,6 +294,30 @@ var cr = function() { |
| }; |
| } |
| + /** |
| + * Forwards public APIs to private implementations. |
| + * @param {Function} ctor Constructor that have private implementations in its |
| + * prototype. |
| + * @param {Array.<string>} publicAPI List of public method names that have |
| + * their underscored counterparts in constructor's prototype. |
| + * @param {HTMLElement=} opt_target Target node (used in |
| + * oobe_screen_user_image.js) |
| + */ |
| + function makePublic(ctor, publicAPI, opt_target) { |
| + publicAPI.forEach(function(name) { |
| + if (opt_target) { |
| + ctor[name] = function(value) { |
| + opt_target[name + '_'](value); |
| + }; |
| + } else { |
| + ctor[name] = function() { |
| + var instance = ctor.getInstance(); |
| + return instance[name + '_'].apply(instance, arguments); |
| + }; |
| + } |
| + }); |
| + } |
| + |
| return { |
| addSingletonGetter: addSingletonGetter, |
| createUid: createUid, |
| @@ -303,6 +327,7 @@ var cr = function() { |
| dispatchSimpleEvent: dispatchSimpleEvent, |
| exportPath: exportPath, |
| getUid: getUid, |
| + makePublic: makePublic, |
|
Dan Beam
2014/09/10 19:26:27
expose might be a better name if it's apparent eno
Vitaly Pavlenko
2014/09/10 20:25:21
So could you propose the best method name to use?
Dan Beam
2014/09/12 00:57:51
Tyler and I agreed that makePublic is fine
Vitaly Pavlenko
2014/09/12 18:38:07
Acknowledged.
|
| PropertyKind: PropertyKind, |
| get doc() { |