Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cordova-plugin-local-notifications
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nabil Sadki
cordova-plugin-local-notifications
Commits
e6041089
Commit
e6041089
authored
Jan 14, 2015
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better type checking
parent
8a8a399e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
11 deletions
+36
-11
local-notification.js
www/local-notification.js
+36
-11
No files found.
www/local-notification.js
View file @
e6041089
...
...
@@ -488,12 +488,22 @@ exports.onclear = function (id, state, json, data) {};
exports
.
mergeWithDefaults
=
function
(
options
)
{
var
defaults
=
this
.
getDefaults
();
options
.
date
=
this
.
getValueFor
(
options
,
'date'
,
'at'
,
'firstAt'
);
options
.
repeat
=
this
.
getValueFor
(
options
,
'repeat'
,
'every'
);
options
.
message
=
this
.
getValueFor
(
options
,
'message'
,
'text'
);
for
(
var
key
in
defaults
)
{
if
(
options
[
key
]
===
null
||
options
[
key
]
===
undefined
)
{
options
[
key
]
=
defaults
[
key
];
}
}
for
(
key
in
options
)
{
if
(
!
defaults
.
hasOwnProperty
(
key
))
{
delete
options
[
key
];
}
}
return
options
;
};
...
...
@@ -509,24 +519,18 @@ exports.mergeWithDefaults = function (options) {
* The converted property list
*/
exports
.
convertProperties
=
function
(
options
)
{
if
(
options
.
id
)
{
options
.
id
=
options
.
id
.
toString
();
}
if
(
options
.
date
===
undefined
)
{
if
(
options
.
date
===
undefined
||
options
.
date
===
null
)
{
options
.
date
=
new
Date
();
}
if
(
options
.
title
)
{
options
.
id
=
options
.
id
.
toString
();
options
.
title
=
options
.
title
.
toString
();
}
if
(
options
.
message
)
{
options
.
message
=
options
.
message
.
toString
();
}
options
.
autoCancel
=
options
.
autoCancel
===
true
;
if
(
options
.
text
)
{
options
.
message
=
options
.
text
.
toString
()
;
if
(
isNaN
(
options
.
badge
)
)
{
options
.
badge
=
this
.
getDefaults
().
badge
;
}
if
(
typeof
options
.
date
==
'object'
)
{
...
...
@@ -613,6 +617,27 @@ exports.convertIds = function (ids) {
/**
* @private
*
* Return the first found value for the given keys.
*
* @param {Object} options
* Object with key-value properties
*
* @param {String[]} keys*
* Key list
*/
exports
.
getValueFor
=
function
(
options
)
{
var
keys
=
Array
.
apply
(
null
,
arguments
).
slice
(
1
);
for
(
var
key
in
keys
)
{
if
(
options
.
hasOwnProperty
(
key
))
{
return
options
[
key
];
}
}
};
/**
* @private
*
* Executes the native counterpart.
*
* @param {String} action
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment