
export default function *() {

	this.on('action.Builder.verify', function *(workspace, boardId, code) {
		var _code = code;

		// No source code given
		if (!_code) {

			// Generate from blockly
			_code = window.Blockly.Arduino.workspaceToCode(workspace);
		}

		this.dispatch('store.Builder.verify', boardId, _code);
	});

	this.on('action.Builder.flash', function *(workspace, boardId, port, code) {
		var _code = code;

		// No source code given
		if (!_code) {

			// Generate from blockly
			_code = window.Blockly.Arduino.workspaceToCode(workspace);

			if (!confirm(_code)) {
				return;
			}
		}

		this.dispatch('store.Builder.flash', boardId, port, _code);
	});
};
