(gui, li, controller)
| 920 | } |
| 921 | |
| 922 | function augmentController(gui, li, controller) { |
| 923 | controller.__li = li; |
| 924 | controller.__gui = gui; |
| 925 | |
| 926 | common.extend(controller, /** @lends Controller.prototype */ { |
| 927 | /** |
| 928 | * @param {Array|Object} options |
| 929 | * @return {Controller} |
| 930 | */ |
| 931 | options: function(options) { |
| 932 | if (arguments.length > 1) { |
| 933 | const nextSibling = controller.__li.nextElementSibling; |
| 934 | controller.remove(); |
| 935 | |
| 936 | return add( |
| 937 | gui, |
| 938 | controller.object, |
| 939 | controller.property, |
| 940 | { |
| 941 | before: nextSibling, |
| 942 | factoryArgs: [common.toArray(arguments)] |
| 943 | } |
| 944 | ); |
| 945 | } |
| 946 | |
| 947 | if (common.isArray(options) || common.isObject(options)) { |
| 948 | const nextSibling = controller.__li.nextElementSibling; |
| 949 | controller.remove(); |
| 950 | |
| 951 | return add( |
| 952 | gui, |
| 953 | controller.object, |
| 954 | controller.property, |
| 955 | { |
| 956 | before: nextSibling, |
| 957 | factoryArgs: [options] |
| 958 | } |
| 959 | ); |
| 960 | } |
| 961 | }, |
| 962 | |
| 963 | /** |
| 964 | * Sets the name of the controller. |
| 965 | * @param {string} name |
| 966 | * @return {Controller} |
| 967 | */ |
| 968 | name: function(name) { |
| 969 | controller.__li.firstElementChild.firstElementChild.innerHTML = name; |
| 970 | return controller; |
| 971 | }, |
| 972 | |
| 973 | /** |
| 974 | * Sets controller to listen for changes on its underlying object. |
| 975 | * @return {Controller} |
| 976 | */ |
| 977 | listen: function() { |
| 978 | controller.__gui.listen(controller); |
| 979 | return controller; |
no test coverage detected
searching dependent graphs…