nativescript-qr-generator
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -1,3 +0,4 @@ | ||
import { Common, QROptions } from './qr-generator.common'; | ||
export declare class QrGenerator extends Common { | ||
import { QROptions } from './common'; | ||
export declare class QrGenerator { | ||
// define your typings manually | ||
@@ -4,0 +5,0 @@ // or.. |
{ | ||
"name": "nativescript-qr-generator", | ||
"version": "2.0.0", | ||
"description": "A NativeScript plugin for generating Qr code images.", | ||
"main": "qr-generator", | ||
"typings": "index.d.ts", | ||
"nativescript": { | ||
"platforms": { | ||
"android": "7.0.0", | ||
"ios": "7.0.0" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/erodriguezh/nativescript-qr-generator.git" | ||
}, | ||
"scripts": { | ||
"tsc": "npm i && ts-patch install && tsc", | ||
"build": "npm run tsc", | ||
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\"", | ||
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**' --exclude '**/platforms/**'", | ||
"demo-angular.ios": "npm i && cd ../demo-angular && tns run ios", | ||
"demo-angular.android": "npm i && cd ../demo-angular && tns run android", | ||
"demo-angular.reset": "cd ../demo-angular && npx rimraf -- hooks node_modules platforms package-lock.json", | ||
"plugin.prepare": "npm run build undefined && cd ../demo-angular && tns plugin remove nativescript-qr-generator && tns plugin add ../src", | ||
"clean": "npm run demo-angular.reset && npx rimraf -- node_modules package-lock.json && npm i" | ||
}, | ||
"keywords": [ | ||
"NativeScript", | ||
"JavaScript", | ||
"Android", | ||
"iOS" | ||
], | ||
"author": { | ||
"name": "Eduardo Rodriguez" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/erodriguezh/nativescript-qr-generator/issues" | ||
}, | ||
"license": "Apache-2.0", | ||
"homepage": "https://github.com/erodriguezh/nativescript-qr-generator", | ||
"devDependencies": { | ||
"@nativescript/core": "~7.0.0", | ||
"@nativescript/types": "~7.0.0", | ||
"@nativescript/webpack": "~3.0.0", | ||
"typescript": "~3.9.0", | ||
"prompt": "^1.0.0", | ||
"rimraf": "^2.6.3", | ||
"tslint": "^5.12.1", | ||
"ts-patch": "~1.3.0", | ||
"semver": "^5.6.0" | ||
}, | ||
"dependencies": { | ||
"ts-node": "^9.0.0" | ||
}, | ||
"bootstrapper": "nativescript-plugin-seed" | ||
"name": "nativescript-qr-generator", | ||
"version": "3.0.0", | ||
"description": "A NativeScript plugin for generating Qr code images.", | ||
"main": "index", | ||
"typings": "index.d.ts", | ||
"nativescript": { | ||
"platforms": { | ||
"ios": "6.0.0", | ||
"android": "6.0.0" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/erodriguezh/nsplugins.git" | ||
}, | ||
"keywords": [ | ||
"NativeScript", | ||
"JavaScript", | ||
"TypeScript", | ||
"iOS", | ||
"Android" | ||
], | ||
"author": { | ||
"name": "Eduardo Rodriguez", | ||
"email": "erodriguezh@users.noreply.github.com" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Kefah BADER ALDIN", | ||
"email": "kefah.bader@gmail.com", | ||
"url": "https://github.com/kefahB" | ||
} | ||
], | ||
"bugs": { | ||
"url": "https://github.com/erodriguezh/nsplugins/issues" | ||
}, | ||
"license": "Apache-2.0", | ||
"homepage": "https://github.com/erodriguezh/nsplugins", | ||
"readmeFilename": "README.md", | ||
"bootstrapper": "@nativescript/plugin-seed" | ||
} |
106
README.md
@@ -10,31 +10,85 @@ # nativescript-qr-generator | ||
```javascript | ||
tns plugin add nativescript-qr-generator | ||
ns plugin add nativescript-qr-generator | ||
``` | ||
## Usage | ||
```typescript | ||
import { Component } from "@angular/core"; | ||
import { ImageSource } from "@nativescript/core"; | ||
import { Image } from "@nativescript/core"; | ||
import { QrGenerator } from "nativescript-qr-generator"; | ||
## Usage | ||
@Component({ | ||
selector: "ns-main", | ||
template: "<Image src="" (loaded)="onImageLoaded($event)"></Image>" | ||
}) | ||
export class AppComponent { | ||
```xml | ||
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo"> | ||
constructor() {} | ||
onImageLoaded(){ | ||
const image = args.object as Image; | ||
const result = new QrGenerator().generate('Hello World'); | ||
image.imageSource = new ImageSource(result); | ||
} | ||
<ActionBar title="My App" icon="" /> | ||
<GridLayout rows="*,*,*" columns="*" class="qr-example"> | ||
<Label row="0" col="0" text="Color and size" ></Label> | ||
<Image src="" row="1" col="0" loaded="{{onImageLoadedBasic}}"></Image> | ||
</GridLayout> | ||
</Page> | ||
``` | ||
```ts | ||
import { Observable, ImageSource, Image } from '@nativescript/core'; | ||
import { QrGenerator } from 'nativescript-qr-generator'; | ||
export class HelloWorldModel extends Observable { | ||
private _counter: number | ||
private _message: string | ||
constructor() { | ||
super(); | ||
} | ||
onImageLoadedBasic(args) { | ||
const image = args.object as Image; | ||
const result = new QrGenerator().generate(`Hello World`, { | ||
logo: { | ||
path: "~/assets/fb.png", | ||
ratio: { | ||
w: 50, h: 50 | ||
} | ||
} | ||
}); | ||
image.imageSource = new ImageSource(result); | ||
} | ||
```) | ||
onImageLoadedColors(args) { | ||
const image = args.object as Image; | ||
const result = new QrGenerator().generate('Hello World with colors', { color: '#4183d7', backgroundColor: '#67809f' }); | ||
image.imageSource = new ImageSource(result); | ||
} | ||
onImageLoadedColorsSize(args) { | ||
const image = args.object as Image; | ||
const result = new QrGenerator().generate('Hello World with colors and custom size', { size: { width: 100, height: 100 }, color: '#fbd90e', backgroundColor: '#0d0c0c' }); | ||
image.imageSource = new ImageSource(result); | ||
} | ||
} | ||
``` | ||
## Usage Angular | ||
```typescript | ||
import { Component } from "@angular/core"; | ||
import { ImageSource } from "@nativescript/core"; | ||
import { Image } from "@nativescript/core"; | ||
import { QrGenerator } from "nativescript-qr-generator"; | ||
@Component({ | ||
selector: "ns-main", | ||
template: "<Image src="" (loaded)="onImageLoaded($event)"></Image>" | ||
}) | ||
export class AppComponent { | ||
constructor() {} | ||
onImageLoaded(){ | ||
const image = args.object as Image; | ||
const result = new QrGenerator().generate('Hello World'); | ||
image.imageSource = new ImageSource(result); | ||
} | ||
} | ||
``` | ||
## API | ||
| Property | Default | Description | | ||
@@ -47,2 +101,8 @@ | --- | --- | --- | | ||
| backgroundColor | '#FFFFFFF' | The background's color | | ||
| logo | none | This new property will add your logo on top of the generated qr-code, the plugin will manage to center the logo, you may want to play with the `ratio` property in case of more complex qr-code | | ||
| logo.path| none | if path not set the plugin will take the appIcon as logo| | ||
| logo.ratio.w| none | set the width of the logo| | ||
| logo.ratio.h| none | set the height of the logo| | ||
| logo.ratio.x| none | set the x cordinate to position the logo| | ||
| logo.ratio.x| none | set the y cordinate to position the logo| | ||
@@ -54,2 +114,2 @@ ## Acknowledgements | ||
**Android:** [https://github.com/kenglxn/QRGen](https://github.com/kenglxn/QRGen)<br /> | ||
**iOS:** [https://github.com/gscarrone/iOS-QR-Code-Generator](https://github.com/gscarrone/iOS-QR-Code-Generator) | ||
**iOS:** [https://github.com/gscarrone/iOS-QR-Code-Generator](https://github.com/gscarrone/iOS-QR-Code-Generator) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
0
113
18940
14
163
1
- Removedts-node@^9.0.0
- Removedarg@4.1.3(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedcreate-require@1.1.1(transitive)
- Removeddiff@4.0.2(transitive)
- Removedmake-error@1.3.6(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsource-map-support@0.5.21(transitive)
- Removedts-node@9.1.1(transitive)
- Removedtypescript@5.7.3(transitive)
- Removedyn@3.1.1(transitive)