Environment Variables

1. Shared State

This feature is only available on macOS 10.15+. Prior to macOS 10.15, it might be crashed.

It's possible to share states from the onRequest() and onResponse() when the script is executed with the global object: sharedState

  • sharedState is a JS Object, so you can assign any keys and values from onRequest(), then receiving it on the onResponse()

function onRequest(context, url, request) {
// Save some state to sharedState
sharedState.url = url;
sharedState.data = "custom";
return request;
function onResponse(context, url, request, response) {
// Receive it
// Done
return response;

sharedStates is only alive on the current flow that executes the script and it's released when the script is run over.

If you would like to persist share data across many scripting session, please consider using Environment Variables

2. Environment Variables

Plan to support soon.