* @param {!cmd.Command} command The initial command. * @param {Atom} atom The name of the atom to execute. * @param params * @return {!Command} The transformed command to execute.
(command, atom, name, ...params)
| 176 | * @return {!Command} The transformed command to execute. |
| 177 | */ |
| 178 | function toExecuteAtomCommand(command, atom, name, ...params) { |
| 179 | if (typeof atom !== 'function') { |
| 180 | throw new InternalTypeError('atom is not a function: ' + typeof atom) |
| 181 | } |
| 182 | |
| 183 | return new cmd.Command(cmd.Name.EXECUTE_SCRIPT) |
| 184 | .setParameter('sessionId', command.getParameter('sessionId')) |
| 185 | .setParameter('script', `/* ${name} */return (${atom}).apply(null, arguments)`) |
| 186 | .setParameter( |
| 187 | 'args', |
| 188 | params.map((param) => command.getParameter(param)), |
| 189 | ) |
| 190 | } |
| 191 | |
| 192 | /** @const {!Map<string, (CommandSpec|CommandTransformer)>} */ |
| 193 | const W3C_COMMAND_MAP = new Map([ |
no test coverage detected