Is it possible to define a handler outside the workflow function

Defining multiple handlers inside the workflow code is really cluttering the workflow code. Is there a way we can just define it outside the workflow code and associate it with the workflow.

Current way:

export async function workflowCode() {
         wf.setHandler(incomingSignal, data => {
                             data = data;
         });
}

is there a better way to define handlers so that it doesn’t clutter the workflow code

Proposed way:

wf.setHandler(incomingSignal, associatedWorkflow, data => {
            data = data;
 });
export async function workflowCode() {
        
}

Any help is highly appreciated!

Yes this is possible, each workflow is executed in an isolated VM environment so you can set anything globally without worrying about isolation and workflow association.