Skip to content

Commit e7f50a8

Browse files
committed
fix readme
1 parent 84a671f commit e7f50a8

File tree

3 files changed

+37
-33
lines changed

3 files changed

+37
-33
lines changed

.gitignore

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
.vs
2-
.vs/
3-
.vscode/
41
*.js
5-
*.map
2+
*.js.map
3+
*.log
4+
demo/app/*.js
5+
demo/*.d.ts
66
demo/platforms
77
demo/node_modules
8-
demo/hooks
9-
demo/tsconfig.json
10-
hooks/
11-
node_modules/
12-
.DS_Store
13-
*.gitattributes
8+
node_modules

README.md

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,51 +21,47 @@ Android | iOS
2121
## Installation
2222
From your command prompt/termial go to your app's root folder and execute:
2323

24-
`npm install nativescript-drawingpad`
24+
`tns plugin add nativescript-drawingpad`
2525

2626
## Usage
2727
#### XML:
2828
```XML
2929
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:DrawingPad="nativescript-drawingpad" loaded="pageLoaded">
30-
<ActionBar title="NativeScript-DrawingPad" color="#fff" backgroundColor="#03A9F4" />
30+
<ActionBar title="NativeScript-DrawingPad" />
3131
<ScrollView>
3232
<StackLayout>
3333

3434
<DrawingPad:DrawingPad
3535
height="400"
3636
id="drawingPad"
37-
penColor="#ff4081" penWidth="3" />
37+
penColor="{{ penColor }}" penWidth="{{ penWidth }}" />
3838

3939
</StackLayout>
4040
</ScrollView>
4141
</Page>
4242
```
4343

44-
#### JS:
45-
```JS
46-
var frame = require("ui/frame");
44+
### TS:
45+
```TS
46+
import { topmost } from 'ui/frame';
47+
import { DrawingPad } from 'nativescript-drawingpad';
4748

4849
// To get the drawing...
49-
function getDrawingAsPic(args) {
50-
// get reference to the drawing pad
51-
var pad = frame.topmost().currentPage.getViewById("drawingPad");
52-
// then get the drawing (Bitmap on Android) of the drawingpad
53-
var drawingImage;
54-
pad.getDrawing().then(function(data) {
55-
console.log(data);
56-
drawingImage = data;
57-
}, function(err) {
58-
console.log(err);
59-
})
60-
}
61-
exports.getDrawingAsPic = getDrawingAsPic;
50+
51+
public getMyDrawing() {
52+
let drawingPad = topmost().getViewById('myDrawingPad');
53+
drawingPad.getDrawing().then((res) => {
54+
console.log(res);
55+
});
56+
}
57+
6258

6359
// If you want to clear the signature/drawing...
64-
function clearUserDrawing(args) {
65-
var pad = frame.topmost().currentPage.getViewById("drawingPad");
66-
pad.clearDrawing();
60+
public clearMyDrawing() {
61+
let drawingPad = topmost().getViewById('myDrawingPad');
62+
drawingPad.clearDrawing();
6763
}
68-
exports.clearUserDrawing = clearUserDrawing;
64+
6965
```
7066

7167
## Angular:

demo/tsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "es5",
5+
"sourceMap": true,
6+
"experimentalDecorators": true,
7+
"noEmitHelpers": true
8+
},
9+
"exclude": [
10+
"node_modules",
11+
"platforms"
12+
]
13+
}

0 commit comments

Comments
 (0)