Skip to content

Commit

Permalink
Some more small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbjensen committed Jan 26, 2020
1 parent fa21571 commit e45ceec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const getStorage = (storageType: string) => {
const getMessagesFromStore = ({ storageType, storageKey }: StorageParams) => {
if (DATA_STORAGE_TYPES.indexOf(storageType) !== -1) {
const storage = getStorage(storageType);
const rawData: null | string = storage?.getItem(storageKey) || null;
const rawData: null | string =
(storage && storage.getItem(storageKey)) || null;
return deserialize(rawData) || [];
}
};
Expand Down Expand Up @@ -388,7 +389,7 @@ export default class Sarus {
const { messages } = this;
const data = messages[0];
if (!data && messages.length === 0) return;
if (this.ws?.readyState === 1) {
if (this.ws && this.ws.readyState === 1) {
this.processMessage(data);
} else {
setTimeout(this.process, this.retryProcessTimePeriod);
Expand Down

0 comments on commit e45ceec

Please sign in to comment.