How to download a resource from an AbstractJavascriptComponent

Hello,

I am using an AbstractJavascriptComponent to wrap an our javascript component. This javascript component has a menu and one of the available actions should let the user download a file.
Currently, when the user clicks on the menu item the event is propagated from javascript to java using the connector and it was very easy to do it and my java side is similar to the below one.

My question is: I am using Page.open method to let the user download a file, but this method is deprecated.
What should I use ? I am not using a vaadin component like a button or a link so the FileDownloader could not be used.

new JavaScriptFunction() {
        private static final long serialVersionUID = 4900265142946983158L;

        @Override
        public void call(JSONArray arguments) throws JSONException {
            String fileName = "myfile.csv";
            StreamSource ss = new StreamResource.StreamSource() {
                @Override
                public InputStream getStream() {
                    return myStream;
                }
            };
            StreamResource resource = new StreamResource(ss, fileName);
            resource.setMIMEType("csv");
            
            getUI().getCurrent().getPage().open(resource, "name", false);
        }
}