17 changed files with 124 additions and 46 deletions
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
export class JSONHttp { |
||||
public async get<T>(url: string): Promise<T> { |
||||
const res = await this.fetch(url); |
||||
return res.json(); |
||||
} |
||||
|
||||
private async fetch(url: string): Promise<Response> { |
||||
return await fetch(url); |
||||
} |
||||
} |
||||
|
||||
export const JSONHttpUtil = new JSONHttp(); |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
export { JSONHttp, JSONHttpUtil } from './http-json'; |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
export * from './https'; |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
export interface IDeserializable<T = unknown> { |
||||
deserialize(input: T): this; |
||||
} |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
export { LogLevel, Logger, LoggerUtils } from './logger'; |
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
export enum LogLevel { |
||||
off = 0, |
||||
Debug, |
||||
Error, |
||||
Warning, |
||||
Info, |
||||
} |
||||
|
||||
export class Logger { |
||||
static level = LogLevel.Debug; |
||||
|
||||
private _source: string; |
||||
|
||||
constructor(component: string) { |
||||
this._source = component; |
||||
} |
||||
|
||||
public debug(...data: unknown[]): void { |
||||
this.log(console.log, LogLevel.Debug, data); |
||||
} |
||||
|
||||
public info(...data: unknown[]): void { |
||||
this.log(console.info, LogLevel.Debug, data); |
||||
} |
||||
|
||||
public warn(...data: unknown[]): void { |
||||
this.log(console.warn, LogLevel.Debug, data); |
||||
} |
||||
|
||||
public error(...data: unknown[]): void { |
||||
this.log(console.error, LogLevel.Debug, data); |
||||
} |
||||
|
||||
private log = (fun: () => void, level: LogLevel, objects: unknown[]): void => { |
||||
if (level >= Logger.level) { |
||||
const log = this._source ? ['[' + this._source + ']'].concat(objects as string[]) : objects; |
||||
fun.apply(console, log); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
export const LoggerUtils = { |
||||
getInstance(className: string): Logger { |
||||
return new Logger(className); |
||||
}, |
||||
}; |
After Width: | Height: | Size: 23 KiB |
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
{ |
||||
"background_color": "#ffffff", |
||||
"theme_color": "#5cb85c", |
||||
"name": "Sveltekit Starter App", |
||||
"short_name": "Sveltekit", |
||||
"display": "minimal-ui", |
||||
"start_url": "/", |
||||
"icons": [ |
||||
{ |
||||
"src": "logo-256.png", |
||||
"sizes": "256x256", |
||||
"type": "image/png" |
||||
} |
||||
] |
||||
} |
Loading…
Reference in new issue