I would love if my Safari app extension could provide preloaded JSON to my content scripts at load time. This would be similar to Safari content blocker rules, which are also preloaded, and are only loaded again if the content blocker extension calls SFContentBlockerManager reloadContentBlockerWithIdentifier. My Safari extension has site-specific preferences. Unfortunately, my content scripts have to make async calls in order to get these preferences. They have to add an event listener for "message", call safari.extension.dispatchMessage, and then wait for the async reply from the app extension. The same thing has to happen on every page load, but the preferences only rarely change, so it's fetching the same data async over and over. Moreover, having only async access to preferences dramatically limits what my content scripts can do, because certain decisions and actions have to be made at page load, before the web site gets a chance to load any of its content. And it also overcomplicates the logic of the content script to make the access to preferences async rather than sync. Having preloaded JSON available to the content script would solve these problems.
I would love if my Safari app extension could provide preloaded JSON to my content scripts at load time. This would be similar to Safari content blocker rules, which are also preloaded, and are only loaded again if the content blocker extension calls SFContentBlockerManager reloadContentBlockerWithIdentifier. My Safari extension has site-specific preferences. Unfortunately, my content scripts have to make async calls in order to get these preferences. They have to add an event listener for "message", call safari.extension.dispatchMessage, and then wait for the async reply from the app extension. The same thing has to happen on every page load, but the preferences only rarely change, so it's fetching the same data async over and over. Moreover, having only async access to preferences dramatically limits what my content scripts can do, because certain decisions and actions have to be made at page load, before the web site gets a chance to load any of its content. And it also overcomplicates the logic of the content script to make the access to preferences async rather than sync. Having preloaded JSON available to the content script would solve these problems.