Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Commit

Permalink
add jshint comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Aug 13, 2020
1 parent 0f6f280 commit 980a33c
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 1,928 deletions.
4 changes: 3 additions & 1 deletion appstorage-cache.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function updateCache(instance) {
/* jshint module: true */

function updateCache(instance) {
instance.cache.put('data', new Response(JSON.stringify(instance.localData)));
}

Expand Down
4 changes: 3 additions & 1 deletion appstorage-localstorage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onCachePutFail(e) {
/* jshint module: true */

function onCachePutFail(e) {
console.log(e);
}

Expand Down
4 changes: 3 additions & 1 deletion appstorage-memory.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export default class MyStore {
/* jshint module: true */

export default class MyStore {
constructor() {

this.localData = {};
Expand Down
18 changes: 10 additions & 8 deletions credentials.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import events from './events.js';
/* jshint module: true */

import events from './events.js';

function ensure(instance, data) {
if (!instance._credentials) {
Expand All @@ -11,14 +13,14 @@ function ensure(instance, data) {
}

function set(instance, data) {
if (data) {
instance._credentials = data;
instance.appStorage.setItem(instance.key, JSON.stringify(data));
} else {
instance.clear();
}
instance._credentials = data;
const json = JSON.stringify(data);
instance.appStorage.setItem(instance.key, json);

events.trigger(instance, 'credentialsupdated');
events.trigger(instance, 'credentialsupdated', [{
credentials: data,
credentialsJson: json
}]);
}

export default class Credentials {
Expand Down
14 changes: 9 additions & 5 deletions events.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function getCallbacks(obj, name) {
/* jshint module: true */

function getCallbacks(obj, name) {

if (!obj) {
throw new Error("obj cannot be null!");
Expand Down Expand Up @@ -45,14 +47,16 @@ export default {
eventArgs.push(eventObject);

const additionalArgs = arguments[2] || [];
for (let i = 0, length = additionalArgs.length; i < length; i++) {
let i, length;
for (i = 0, length = additionalArgs.length; i < length; i++) {
eventArgs.push(additionalArgs[i]);
}

const callbacks = getCallbacks(obj, eventName).slice(0);

callbacks.forEach(c => {
c.apply(obj, eventArgs);
});
for (i = 0, length = callbacks.length; i < length; i++) {

callbacks[i].apply(obj, eventArgs);
}
}
};
Loading

0 comments on commit 980a33c

Please sign in to comment.