-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Redo swarm Redo swarm to use network scanning and local storage rather than storing the set of IP's on device. * auto refresh --------- Co-authored-by: Benjamin Wilson <[email protected]>
- Loading branch information
1 parent
8630fa3
commit e0090fd
Showing
5 changed files
with
188 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
main/http_server/axe-os/src/app/local-storage.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { LocalStorageService } from './local-storage.service'; | ||
|
||
describe('LocalStorageService', () => { | ||
let service: LocalStorageService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({}); | ||
service = TestBed.inject(LocalStorageService); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class LocalStorageService { | ||
|
||
constructor() { } | ||
|
||
setItem(key: string, value: any) { | ||
localStorage.setItem(key, value); | ||
} | ||
|
||
getItem(key: string): any { | ||
return localStorage.getItem(key); | ||
} | ||
|
||
setBool(key: string, value: boolean) { | ||
localStorage.setItem(key, String(value)); | ||
} | ||
|
||
getBool(key: string): boolean { | ||
return localStorage.getItem(key) === 'true'; | ||
} | ||
|
||
setObject(key: string, value: object) { | ||
localStorage.setItem(key, JSON.stringify(value)); | ||
} | ||
|
||
getObject(key: string): any | null{ | ||
const item = localStorage.getItem(key); | ||
if(item == null || item.length < 1){ | ||
return null; | ||
} | ||
return JSON.parse(item); | ||
} | ||
} |
Oops, something went wrong.