Frappe.get_prev_route() not working

Why frappe.get_prev_route() client-side method just work on browser console and on an app that returns null?

Can you post an example of where this might be useful. I am currently trying to write a custom script that has to take values from the previous DocType and this might be useful. Were you able to get it to work?

I was doing it wrong, if someone need an example how to do it, here is:

frappe.ui.form.on('DocType', {
    trigger: function (frm) {
        // Get document previous route
        prev_route = frappe.get_prev_route();
        prev_doctype = prev_route[1];
        prev_docname = prev_route[2];
        prev_doc = frappe.get_doc(prev_doctype, prev_docname);
    },
});