Skip to main content Link Search Menu Expand Document (external link)

Profile Provider Factory Object

The profile provider factory object defines a standard interface by which profile providers can be added and modified.

const MyProfileProviderFactory = {
  id: 'acada807-786e-4bdc-9609-54522396c786',
  description: 'Load profiles from our fictitious API',
  createProvider(jancy, state=null) {
    return new MyProfileProvider(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 profile 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.

image info

createProvider (function)

Called to create an instance of this factory’s profile provider.

createProvider will be called with the following arguments:

  • jancy (Jancy object) the global Jancy object
  • state (any) information used to create your provider

addProvider (function)

Called when the user wants to add a new instance of this factorys [profile provider`](./profile-provider).

addProvider will be called with the following arguments:

addProvider should ultimately call jancy.profileProviders.createProvider() to add a new profile 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 object
  • browserWindow (BrowserWindow)
  • provider (Profile provider) a previously created profile provider instance created by this factory

editProvider should ultimately call jancy.profileProviders.saveProvider() to save any changes to the state of the provider.