Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Copicake/copicake-js
Browse files Browse the repository at this point in the history
  • Loading branch information
EragonJ committed Jan 19, 2023
2 parents b1222db + 99cb0db commit b8c0f02
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## [1.0.6](https://github.com/Copicake/copicake-js/compare/v1.0.5...v1.0.6) (2022-06-12)


### Bug Fixes

* bump version ([17daedd](https://github.com/Copicake/copicake-js/commit/17daedd7ea0be558e20b21a08e205a62524b0f72))
* updated types & changed README ([d6e5768](https://github.com/Copicake/copicake-js/commit/d6e576845edf06ea22e2a33677ad99f8314af17e))

## [1.0.5](https://github.com/Copicake/copicake-js/compare/v1.0.4...v1.0.5) (2022-05-26)


Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ npm install --save @copicake/copicake-js
## For yarn user

```bash
yarn add @copicake/copicake-js --dev
yarn add @copicake/copicake-js
```

# Usage
Expand Down Expand Up @@ -89,7 +89,7 @@ Sometimes you may notice that your image is still under `processing` state, this

In this way, we provide another handy method called `getUntilFinished()` to get the image until the image is ready.

Internally, this is just a wrapper of `get()` method with built-in retry mechanism. If after MAX_RETRY_TIMES and the image is still under `processing` state, we will throw an error (500) to let you know.
Internally, this is just a wrapper of `get()` method with built-in retry mechanism. If after `MAX_RETRY_TIMES` and the image is still under `processing` state, we will throw an error (500) to let you know.

```js
const renderingId = `YOUR_RENDERING_ID`;
Expand Down
6 changes: 6 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
]
}
2 changes: 2 additions & 0 deletions src/lib/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ export const UPLOAD_TEMP_IMAGE_API_END_POINT = `${API_END_POINT}/v1/utils/upload
export const IMAGE_API_END_POINT = `${API_END_POINT}/v1/image`;

export const RETRY_TIMEOUT = 1000;

export const MAX_RETRY_TIMES = 10;
9 changes: 6 additions & 3 deletions src/lib/image.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import unfetch from "isomorphic-unfetch";
import { Rendering, Change, Options } from "../types/Rendering";
import { IMAGE_API_END_POINT, RETRY_TIMEOUT } from "./constant";
import {
IMAGE_API_END_POINT,
RETRY_TIMEOUT,
MAX_RETRY_TIMES,
} from "./constant";

// Bug: Failed to execute 'fetch' on 'Window': Illegal invocation
const fetch = unfetch.bind(globalThis);
const MAX_RETRY_TIMES = 10;
const fetch = unfetch.bind(self);

interface ICreate {
template_id: string;
Expand Down

0 comments on commit b8c0f02

Please sign in to comment.