Skip to content

Commit

Permalink
chore: format codebase with new Prettier 3 style
Browse files Browse the repository at this point in the history
  • Loading branch information
crutchcorn committed Dec 17, 2024
1 parent 062545a commit 8ee960c
Show file tree
Hide file tree
Showing 81 changed files with 3,095 additions and 3,283 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: pr
on:
pull_request:
paths-ignore:
- 'media/**'
- "media/**"

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
Expand Down
6 changes: 3 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"useTabs": true
}
{
"useTabs": true
}
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,28 @@ The `node-vibrant` package still provides default experience out-of-box.

## Breaking Changes

* `strickNullChecks` flag is now enabled.
* Prebuilt bundle will not be provided. You should use your own `webpack` workflow.
- `strickNullChecks` flag is now enabled.
- Prebuilt bundle will not be provided. You should use your own `webpack` workflow.

# 3.1.0

- Fix empty swatches sometimes showing up for images
- Update deps
- Moved from Bluebird to native promises
- Fix issue with dist folder not appearing on install
- Fix issue with images not loading properly

# 3.0.0

## New WebWorker support in v3.0

Quantization is the most time-consuming stage in `node-vibrant`. In v3.0, the quantization can be run in the WebWorker to avoid freezing the UI thread.

Here's how to use this feature:

1. Use WebWorker build `dist/vibrant.worker.js` or `dist/vibrant.worker.min.js`. Or if you are re-bundling with webpack, use `lib/bundle.worker.js` as entry
2. Use WebWorker quantizer:
```ts
let v = Vibrant.from(src)
.useQuantizer(Vibrant.Quantizer.WebWorker)
// Other configurations
let v = Vibrant.from(src).useQuantizer(Vibrant.Quantizer.WebWorker);
// Other configurations
```
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,26 @@ $ npm install node-vibrant

```typescript
// Node
import Vibrant from 'node-vibrant/node'
import Vibrant from "node-vibrant/node";
// Browser
import Vibrant from 'node-vibrant/browser'
import Vibrant from "node-vibrant/browser";
// Web Worker
import Vibrant from 'node-vibrant/worker'
import Vibrant from "node-vibrant/worker";

// Using builder
Vibrant.from('path/to/image').getPalette((err, palette) => console.log(palette))
Vibrant.from("path/to/image").getPalette((err, palette) =>
console.log(palette),
);
// Promise
Vibrant.from('path/to/image').getPalette()
.then((palette) => console.log(palette))
Vibrant.from("path/to/image")
.getPalette()
.then((palette) => console.log(palette));

// Using constructor
let v = new Vibrant('path/to/image', opts)
v.getPalette((err, palette) => console.log(palette))
let v = new Vibrant("path/to/image", opts);
v.getPalette((err, palette) => console.log(palette));
// Promise
v.getPalette().then((palette) => console.log(palette))
v.getPalette().then((palette) => console.log(palette));
```

## Documentation
Expand Down
Loading

0 comments on commit 8ee960c

Please sign in to comment.