Skip to content

Commit

Permalink
Fixed lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yasharpm committed Aug 15, 2024
1 parent 07bcf1c commit 8facb19
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/interfaces/configObserver.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default interface ConfigObserver {
export interface ConfigObserver {
onConfigChanged(config: string): void;
}
4 changes: 2 additions & 2 deletions src/remotestorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ class RemoteStorage {
case 'pod-not-selected':
if ((this.remote instanceof Solid)
&& this.remote.getPodURLs().length > 0
&& this.remote.getPodURL() == null) {
setTimeout(handler, 0);
&& this.remote.getPodURL() === null) {
setTimeout(handler, 0);
}
break;
}
Expand Down
22 changes: 15 additions & 7 deletions src/solid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
localStorageAvailable
} from './util';
import {Remote, RemoteBase, RemoteResponse, RemoteSettings} from "./remote";
import ConfigObserver from "./interfaces/configObserver";
import { ConfigObserver } from "./interfaces/configObserver";
import ConfigStorage from "./solidStorage";
import Blob from "blob";

Expand Down Expand Up @@ -65,10 +65,18 @@ function unHookGetItemURL (rs): void {
*/
function requestBodyToBlob(body: XMLHttpRequestBodyInit): Blob {
if (typeof(body) === 'object') {
if (body instanceof Blob) return body;
if (body instanceof DataView) return new Blob([ body ], { type : "application/octet-stream" });
if (body instanceof ArrayBuffer) return new Blob([ new DataView(body) ]);
if (ArrayBuffer.isView(body)) return new Blob([ body ], { type : "application/octet-stream" });
if (body instanceof Blob) {
return body;
}
if (body instanceof DataView) {
return new Blob([ body ], { type : "application/octet-stream" });
}
if (body instanceof ArrayBuffer) {
return new Blob([ new DataView(body) ]);
}
if (ArrayBuffer.isView(body)) {
return new Blob([ body ], { type : "application/octet-stream" });
}
if (body instanceof FormData) {
return new Blob([ new URLSearchParams([JSON.parse(JSON.stringify(body.entries()))]).toString() ],
{ type : 'application/x-www-form-urlencoded' });
Expand Down Expand Up @@ -347,7 +355,7 @@ class Solid extends RemoteBase implements Remote, ConfigObserver {
map[itemName] = {
'Content-Length': 1, // TODO FIX THESE
'Last-Modified': 1, // date.toUTCString()
}
};
}

return map;
Expand Down Expand Up @@ -424,7 +432,7 @@ class Solid extends RemoteBase implements Remote, ConfigObserver {
}).catch(error => {
return Promise.reject("PUT failed with status " + error.statusCode + " (" + error.message + ")");
});
}
};

return getFile(fileURL, { fetch: fetch}).then(file => {
if (options && (options.ifNoneMatch === '*')) {
Expand Down
8 changes: 4 additions & 4 deletions src/solidStorage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
IStorage,
} from "@inrupt/solid-client-authn-browser";
import ConfigObserver from "./interfaces/configObserver";
IStorage,
} from "@inrupt/solid-client-authn-browser";
import { ConfigObserver } from "./interfaces/configObserver";

class BrowserStorage implements IStorage {
get storage(): typeof window.localStorage {
Expand All @@ -27,7 +27,7 @@ export default class ConfigStorage implements IStorage {
private observer: ConfigObserver;

constructor(observer: ConfigObserver) {
this.observer = observer;
this.observer = observer;
}

private isConfigKey(key: string): boolean {
Expand Down

0 comments on commit 8facb19

Please sign in to comment.