Skip to content

Instantly share code, notes, and snippets.

@jacksteamdev
Created January 15, 2020 15:13
Show Gist options
  • Save jacksteamdev/5e67d0b8a4ad0685506c2d6c352a6e43 to your computer and use it in GitHub Desktop.
Save jacksteamdev/5e67d0b8a4ad0685506c2d6c352a6e43 to your computer and use it in GitHub Desktop.
Collapsable Markdown

function `getBucket`

function getBucket(bucketName: string, [areaName = 'local']) => Bucket

Returns a Bucket.

Parameters

bucketName
Type: string
A unique id for this bucket.

[areaName]
Type: "local" or "sync"
Default: "local"
Choose which native Chrome API storage area to use.

// JavaScript
const localBucket = getBucket('bucket1')
const syncBucket = getBucket('bucket2', 'sync')

// TypeScript
const localBucket = getBucket<{ a: string }>('bucket1')
const syncBucket = getBucket<{ b: number }>('bucket2', 'sync')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment