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)

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

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
})