Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
import Multicast from '@sanity/observable/multicast'
import Observable from '@sanity/observable'
import {uploadImageAsset} from '../inputs/client-adapters/assets'
const uploadRequests$ = new Multicast
const CONCURRENCY = 4
const registry = []
export function createUploadId(file: File): number {
const id = registry.length
const events = new Multicast
registry[id] = {
file,
events$: events.asObservable().do({
complete: () => {
registry[id] = null
}}),
_multicast: events
}
return id
export function createUploadId(file: File): number {
const id = registry.length
const events = new Multicast
registry[id] = {
file,
events$: events.asObservable().do({
complete: () => {
registry[id] = null
}}),
_multicast: events
}
return id
}