perf: remove callbackToObserve
This commit is contained in:
parent
437c234f8a
commit
415b9f507e
3 changed files with 2 additions and 21 deletions
|
@ -1,10 +1,10 @@
|
|||
import { Remesh } from 'remesh'
|
||||
import { map, merge, of, EMPTY, mergeMap, fromEvent, Observable, tap } from 'rxjs'
|
||||
import { map, merge, of, EMPTY, mergeMap, fromEvent, Observable, tap, fromEventPattern } from 'rxjs'
|
||||
import { NormalMessage, type MessageUser } from './MessageList'
|
||||
import { PeerRoomExtern } from '@/domain/externs/PeerRoom'
|
||||
import MessageListDomain, { MessageType } from '@/domain/MessageList'
|
||||
import UserInfoDomain from '@/domain/UserInfo'
|
||||
import { fromEventPattern, desert, upsert } from '@/utils'
|
||||
import { desert, upsert } from '@/utils'
|
||||
import { nanoid } from 'nanoid'
|
||||
import StatusModule from '@/domain/modules/Status'
|
||||
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
import { Observable } from 'rxjs'
|
||||
|
||||
export type Subscribe<T> = (callback: (event: T) => void) => void
|
||||
|
||||
const fromEventPattern = <T>(subscribe: Subscribe<T>, unsubscribe?: () => void) => {
|
||||
return new Observable<T>((subscriber) => {
|
||||
subscribe((event: T) => {
|
||||
subscriber.next(event)
|
||||
})
|
||||
|
||||
return () => {
|
||||
unsubscribe?.()
|
||||
subscriber.complete()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default fromEventPattern
|
|
@ -5,7 +5,6 @@ export { default as getSiteInfo } from './getSiteInfo'
|
|||
export { default as compressImage } from './compressImage'
|
||||
export { default as isNullish } from './isNullish'
|
||||
export { default as checkSystemDarkMode } from './checkSystemDarkMode'
|
||||
export { default as fromEventPattern } from './fromEventPattern'
|
||||
export { default as stringToHex } from './stringToHex'
|
||||
export { default as debounce } from './debounce'
|
||||
export { default as throttle } from './throttle'
|
||||
|
|
Loading…
Reference in a new issue