/**
 * Created by rockyl on 2019-11-16.
 */

let targetNode = props.target || target;
if (targetNode) {
	const {scripts} = targetNode;
	const {scriptIndex, scriptName, enabled} = props;
	let script;
	if (scriptIndex !== undefined) {
		script = scripts.all[scriptIndex];
	} else if (scriptName !== undefined) {
		script = scripts.get(scriptName);
	}
	if (script && props.props) {
		if(Array.isArray(script)){
			for(let item of script){
				engine.injectProp(item, props.props);
			}
		}else{
			engine.injectProp(script, props.props);
		}
	}
}

next('success', args);
