@@ -102,9 +102,16 @@ export default class Dispatcher extends Component {
102102 let actionCreator = ( ) => ( { } ) , argsToInject = [ ] ;
103103 if ( this . state . selectedActionCreator !== 'default' ) {
104104 actionCreator = this . getSelectedActionCreator ( ) . func ;
105- argsToInject = this . state . args . map (
106- ( arg ) => ( new Function ( 'return ' + arg ) ) ( )
107- ) ;
105+
106+ const interpretArg = ( arg ) => ( new Function ( 'return ' + arg ) ) ( )
107+ argsToInject = this . state . args . map ( interpretArg ) ;
108+ const rest = interpretArg ( this . refs . restArgs . textContent ) ;
109+ if ( rest ) {
110+ if ( Array . isArray ( rest ) )
111+ argsToInject = argsToInject . concat ( ...rest ) ;
112+ else
113+ throw new Error ( 'rest must be an array' ) ;
114+ }
108115 } else {
109116 actionCreator = new Function ( 'return ' + this . refs . action . textContent ) ;
110117 }
@@ -186,12 +193,19 @@ export default class Dispatcher extends Component {
186193
187194 let fields = < div contentEditable style = { contentEditableStyle } ref = 'action' > </ div > ;
188195 if ( this . state . selectedActionCreator !== 'default' ) {
196+ const fieldStyles = { ...styles . label , color : theme . base06 } ;
189197 fields = this . getSelectedActionCreator ( ) . args . map ( ( param , i ) => (
190198 < div key = { i } style = { { display : 'flex' } } >
191- < span style = { { ... styles . label , color : theme . base06 } } > { param } </ span >
192- < div contentEditable style = { contentEditableStyle } ref = { 'arg' + i } onInput = { ( e ) => this . handleArg ( e , i ) } > </ div >
199+ < span style = { fieldStyles } > { param } </ span >
200+ < div contentEditable style = { contentEditableStyle } ref = { 'arg' + i } onInput = { ( e ) => this . handleArg ( e , i ) } / >
193201 </ div >
194202 ) ) ;
203+ fields . push (
204+ < div key = "action" style = { { display : 'flex' } } >
205+ < span style = { fieldStyles } > rest...</ span >
206+ < div contentEditable style = { contentEditableStyle } ref = "restArgs" />
207+ </ div >
208+ ) ;
195209 }
196210
197211 let error = '' ;
0 commit comments