[#564] Modified machinery JS to export preview function.