Skip to content

Commit 7ddd5db

Browse files
committedJul 12, 2023
Update documentation and version
1 parent 19737f5 commit 7ddd5db

File tree

7 files changed

+26
-6
lines changed

7 files changed

+26
-6
lines changed
 

‎docs/.vuepress/components/brush-circle.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
import('../../../build/scratchcard.min').then(() => {
7171
const scContainer = document.getElementById('js--sc--container')
7272
const scInfos = document.querySelector('.sc__infos');
73-
const sc = new ScratchCard('#js--sc--container', {
73+
const sc = new ScratchCard(scContainer, {
7474
scratchType: SCRATCH_TYPE.CIRCLE,
7575
containerWidth: scContainer.offsetWidth,
7676
containerHeight: 300,

‎docs/.vuepress/components/brush-html.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
import('../../../build/scratchcard.min').then(() => {
132132
const scContainer = document.getElementById('js--sc--container')
133133
const scInfos = document.querySelector('.sc__infos');
134-
const sc = new ScratchCard('#js--sc--container', {
134+
const sc = new ScratchCard(scContainer, {
135135
scratchType: SCRATCH_TYPE.CIRCLE,
136136
containerWidth: scContainer.offsetWidth,
137137
containerHeight: 300,

‎docs/.vuepress/components/brush-img.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
import('../../../build/scratchcard.min').then(() => {
7272
const scContainer = document.getElementById('js--sc--container')
7373
const scInfos = document.querySelector('.sc__infos');
74-
const sc = new ScratchCard('#js--sc--container', {
74+
const sc = new ScratchCard(scContainer, {
7575
scratchType: SCRATCH_TYPE.BRUSH,
7676
containerWidth: scContainer.offsetWidth,
7777
containerHeight: 300,

‎docs/.vuepress/components/brush-line.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
import('../../../build/scratchcard.min').then(() => {
7171
const scContainer = document.getElementById('js--sc--container')
7272
const scInfos = document.querySelector('.sc__infos');
73-
const sc = new ScratchCard('#js--sc--container', {
73+
const sc = new ScratchCard(scContainer, {
7474
scratchType: SCRATCH_TYPE.LINE,
7575
containerWidth: scContainer.offsetWidth,
7676
containerHeight: 300,

‎docs/.vuepress/components/brush-spray.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
import('../../../build/scratchcard.min').then(() => {
7171
const scContainer = document.getElementById('js--sc--container')
7272
const scInfos = document.querySelector('.sc__infos');
73-
const sc = new ScratchCard('#js--sc--container', {
73+
const sc = new ScratchCard(scContainer, {
7474
scratchType: SCRATCH_TYPE.SPRAY,
7575
containerWidth: scContainer.offsetWidth,
7676
containerHeight: 300,

‎docs/readme.md

+20
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,26 @@ import 'scratchcard-js';
1818
```
1919

2020
## Configuration
21+
::: Tip
22+
The first argument of the ScratchCard instance can be a string or an HTMLElement.
23+
:::
24+
25+
```js{2}
26+
const scContainer = document.getElementById('js--sc--container');
27+
const sc = new ScratchCard(scContainer, {
28+
scratchType: SCRATCH_TYPE.LINE,
29+
containerWidth: scContainer.offsetWidth,
30+
containerHeight: 300,
31+
imageForwardSrc: '/images/scratchcard.jpg',
32+
imageBackgroundSrc: '/images/result.png',
33+
htmlBackground: '',
34+
clearZoneRadius: 20,
35+
nPoints: 0,
36+
pointSize: 0,
37+
callback: function () {}
38+
})
39+
```
40+
2141
See the SCRATCH_TYPES in action: [Line](/brushes/line), [Spray](/brushes/spray), [Circle](/brushes/circle), [Brush](/brushes/brush)
2242
| Name | Type | Default value | Comment |
2343
|---|---|---|---|

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scratchcard-js",
3-
"version": "1.4.10",
3+
"version": "1.5.0",
44
"description": "Create scratch card in browser.",
55
"main": "./build/scratchcard.min.js",
66
"scripts": {

0 commit comments

Comments
 (0)
Failed to load comments.