mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
Feature/shared refactor (#1176)
* refactor: move most of the shared entities to @start8labs/shared library
This commit is contained in:
13
frontend/projects/shared/src/services/destroy.service.ts
Normal file
13
frontend/projects/shared/src/services/destroy.service.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Injectable, OnDestroy } from '@angular/core'
|
||||
import { ReplaySubject } from 'rxjs'
|
||||
|
||||
/**
|
||||
* Observable abstraction over ngOnDestroy to use with takeUntil
|
||||
*/
|
||||
@Injectable()
|
||||
export class DestroyService extends ReplaySubject<void> implements OnDestroy {
|
||||
ngOnDestroy() {
|
||||
this.next()
|
||||
this.complete()
|
||||
}
|
||||
}
|
||||
18
frontend/projects/shared/src/services/emver.service.ts
Normal file
18
frontend/projects/shared/src/services/emver.service.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import * as emver from '@start9labs/emver'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class Emver {
|
||||
constructor() {}
|
||||
|
||||
compare(lhs: string, rhs: string): number {
|
||||
if (!lhs || !rhs) return null
|
||||
return emver.compare(lhs, rhs)
|
||||
}
|
||||
|
||||
satisfies(version: string, range: string): boolean {
|
||||
return emver.satisfies(version, range)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user