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

The Partition Registry

All tabs that are related and sharing the same session information (i.e. cookies, proxies, profiles, etc) are grouped together into partitions. The Partition Registry is responsible for creating and keeping track of all the partitions and the the tabs assigned to them.

There is only one partition registry and it can always be found at jancy.partitions.

Methods

partitions.addCookies(partition, cookies)

Returns a promise that resolves when the specified cookie objects have been added to the partition.

Each cookie in the array of cookies should be constructed with the partitions.makeCookie() method.

// Assuming we get a tab object from somewhere...
const tab = ...
const partition = jancy.partitions.getPartition(tab.partitionId)
const newCookie = jancy.partitions.makeCookie({
  name: 'my-cookie',
  value: '1',
  domain: '.google.com',
  path: '/',
  secure: true,
  httpOnly: true
})
await jancy.partitions.addCookies(partition, [ newCookie ])

partitions.clearCookies(partition)

partition can either be a Partition object or an ID of a partition represented as a string.

Returns a promise that resolves when the cookies for the partition have been cleared.

// Assuming we get a tab object from somewhere...
const tab = ...
jancy.partitions.getPartition(tab.partitionId)
jancy.partitions.clearCookies(partition)

Since Jancy 1.9.2, this method is also callable via an action.

const tab = window.jancyAPI.getTabInfo()
window.jancyAPI.dispatchAction(
  'partitions:call',
  { method: 'clearCookies', args: [ tab.partitionId ] }
)

partitions.clearHTTPCache(partition)

partition can either be a Partition object or an ID of a partition represented as a string.

Returns a promise that resolves when the HTTP cache for the partition has been cleared.

// Assuming we get a tab object from somewhere...
const tab = ...
jancy.partitions.getPartition(tab.partitionId)
jancy.partitions.clearHTTPCache(partition)

Since Jancy 1.9.3, this method is also callable via an action.

const tab = window.jancyAPI.getTabInfo()
window.jancyAPI.dispatchAction(
  'partitions:call',
  { method: 'clearHTTPCache', args: [ tab.partitionId ] }
)

partitions.clearStorageData(partition)

partition can either be a Partition object or an ID of a partition represented as a string.

Returns a promise that resolves when the local and session storage data for the partition has been cleared.

// Assuming we get a tab object from somewhere...
const tab = ...
jancy.partitions.getPartition(tab.partitionId)
jancy.partitions.clearStorageData(partition)

Since Jancy 1.9.3, this method is also callable via an action.

const tab = window.jancyAPI.getTabInfo()
window.jancyAPI.dispatchAction(
  'partitions:call',
  { method: 'clearStorageData', args: [ tab.partitionId ] }
)

partitions.getCookies(partition)

Returns a promise that resolves with an array of Cookie objects.

partitions.getPartition(id)

  • id (string)

Returns a partition object identified by id or null.

// Assuming we get a tab object from somewhere...
const tab = ...
const partition = jancy.partitions.getPartition(tab.partitionId)

partitions.makeCookie(cookieDefinition)

  • cookieDefinition (Object)
    • name (string) optional the name of the cookie.
    • value (string) optional the value of the cookie.
    • domain (string) optional the domain of the cookie.

    domain will be normalized with a preceding dot so that it’s also valid for subdomains.

    • path (string) optional the path of the cookie.
    • secure (boolean) optional whether the cookie should be marked as Secure.

    Default is false.

    • httpOnly (boolean) optional whether the cookie should be marked as HTTP only.

    Default is false.

    • expirationDate (number) optional the expiration date of the cookie as the number of seconds since the UNIX epoch.
    • sameSite (string) optional the Same Site that applies to this cookie.

    Valid values are unspecified, no_restriction, lax or strict. Default is lax.

Returns a valid cookie object suitable for calls to partitions.addCookies()

const newCookie = jancy.partitions.makeCookie({
  name: 'my-cookie',
  value: '1',
  domain: '.google.com',
  path: '/',
  secure: true,
  httpOnly: true
})

partitions.skipProxy(partition)

partition can either be a Partition object or an ID of a partition represented as a string.

Force a partition to get a new proxy from it’s configured proxy provider. Returns a promise that resolves when the proxy has been updated.

// Assuming we get a tab object from somewhere...
const tab = ...
jancy.partitions.getPartition(tab.partitionId)
jancy.partitions.skipProxy(partition)

Since Jancy 1.9.2, this method is also callable via an action.

const tab = window.jancyAPI.getTabInfo()
window.jancyAPI.dispatchAction(
  'partitions:call',
  { method: 'skipProxy', args: [ tab.partitionId ] }
)