Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
👕 Fixing linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
macdonst committed Aug 28, 2017
1 parent 9998b52 commit 1b109f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"scripts": {
"build": "babel src/js --out-dir www",
"build:watch": "nodemon -w ./src/js -e js -x npm run build",
"eslint": "node node_modules/.bin/eslint src/js",
"jasmine": "jasmine-node --color spec",
"test": "npm run build && npm run jasmine"
},
Expand Down
13 changes: 6 additions & 7 deletions src/js/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,19 @@ class PushNotification {
// triggered on registration and notification
const success = (result) => {
if (result && typeof result.registrationId !== 'undefined') {
this.emit('registration', result);
this.emit('registration', result);
} else if (result && result.additionalData &&
typeof result.additionalData.actionCallback !== 'undefined') {
const executeFuctionOrEmitEventByName = (functionName, context, ...args) => {
const namespaces = functionName.split('.');
const func = namespaces.pop();
let innerContext = context;
for (let i = 0; i < namespaces.length; i++) {
context = context[namespaces[i]];
innerContext = innerContext[namespaces[i]];
}

if (typeof context[func] === 'function') {
context[func].call(context, args);
if (typeof innerContext[func] === 'function') {
innerContext[func].call(innerContext, args);
} else {
this.emit(functionName, args);
}
Expand Down Expand Up @@ -297,9 +298,7 @@ module.exports = {
* @return {PushNotification} instance
*/

init: (options) => {
return new PushNotification(options);
},
init: (options) => new PushNotification(options),

hasPermission: (successCallback, errorCallback) => {
exec(successCallback, errorCallback, 'PushNotification', 'hasPermission', []);
Expand Down

0 comments on commit 1b109f5

Please sign in to comment.