File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,27 @@ From the command prompt go to your app's root folder and execute:
99tns plugin add nativescript-local-notifications
1010```
1111
12+ #### TypeScript support
13+ And do yourself a favor by adding TypeScript support to your nativeScript app:
14+
15+ ````
16+ tns install typescript
17+ ```
18+
19+ Then open `references.d.ts` in the root of your project and add this line to get autocompletion and type-checking for this plugin:
20+
21+ /// <reference path="./node_modules/nativescript-local-notifications/local-notifications.d.ts" />
22+
23+ Now you can import the plugin as an object into your `.ts` file as follows:
24+
25+ ```js
26+ // import the TS definitions
27+ import * as LocalNotifications from "nativescript-local-notifications";
28+
29+ // .. and use it as:
30+ LocalNotifications.hasPermission()..
31+ ```
32+
1233## Usage
1334
1435If you want a quickstart, [clone our demo app](https://github.com/EddyVerbruggen/nativescript-local-notifications-demo).
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ LocalNotifications.hasPermission = function (arg) {
5656LocalNotifications . _hasPermission = function ( ) {
5757 var settings = UIApplication . sharedApplication ( ) . currentUserNotificationSettings ( ) ;
5858 var types = UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound ;
59- return settings . types & types ;
59+ return ( settings . types & types ) > 0 ;
6060} ;
6161
6262LocalNotifications . requestPermission = function ( arg ) {
You can’t perform that action at this time.
0 commit comments