Proxy Provider Factory Object
The proxy provider factory object defines a standard interface by which proxy providers can be added and modified.
const ProxyProviderFactory = { id: 'b504159b-9699-4876-a1d1-395ca752aeb4', description: 'Load proxies from our fictitious API', showFactoriesToUser: true, persistProviders: true, createProvider(jancy, state=null) { return new ProxyProvider(jancy, state) }, addProvider(jancy, browserWindow) { dialog(jancy, browserWindow) }, editProvider(jancy, browserWindow, provider) { dialog(jancy, browserWindow, provider) } }
Properties
id (string
)
An ID that is guaranteed to be unqiue amongst all proxy provider factory objects.
It’s best to generate this ID with uuidgen
or something similar.
description (string
)
A string describing your factory. Used for display purposes in the application when the user adds a new provider.
showFactoriesToUser (boolean
)
Determines if this factory should present itself in the menu that appears when the user clicks the + button in the Proxy settings panel.
Usually you’d set this to true
.
persitProvidrs (boolean
)
Determines if this factory creates providers that save and restore themselves to and from disk when Jancy starts and stops.
Usually you’d set this to true
.
createProvider (function
)
Called to create an instance of this factory’s proxy provider
.
createProvider
will be called with the following arguments:
jancy
(Jancy object
) the global Jancy objectstate
(any
) information used to create your provider
addProvider (function
)
Called when the user wants to add a new instance of this factorys [
proxy provider`](./proxy-provider).
addProvider
will be called with the following arguments:
jancy
(Jancy object
) the global Jancy objectbrowserWindow
(BrowserWindow
)
addProvider
should ultimately call jancy.proxyProviders.createProvider()
to add a new proxy provider instance to the system.
addProvider
should typically present a dialog to the user to prompt for initial creation details but it doesn’t have to.
editProvider (function
)
Called when the user wants to edit an existing instance of a provider created by this factory.
editProvider
will be called with the following arguments:
jancy
(Jancy object
) the global Jancy objectbrowserWindow
(BrowserWindow
)provider
(Proxy provider
) a previously created proxy provider instance created by this factory
editProvider
should ultimately call jancy.profileProviders.saveProvider()
to save any changes to the state of the provider.