javascript – What is “open()” in MediaUpload?

Googling (or searching here) on “open” is hard 🙂

The readme for MediaUpload gives this example:

            onSelect={ ( media ) => console.log( 'selected ' + media.length ) }
            allowedTypes={ ALLOWED_MEDIA_TYPES }
            value={ mediaId }
            render={ ( { open } ) => (
                <Button onClick={ open }>
                    Open Media Library
            ) }

And, indeed, in the MediaPlaceholder core component it gets used that way:

                            // ...
                            render={ ( { open } ) => {
                                    return (
                                                    onClick={ ( event ) => {
                                                    } }
                                                    { __( 'Media Library' ) }
                            } }

But I can’t figure out what that “open()” is, where it’s documented, etc….

If someone can point me at it, I’m happy to go read documentation and/or UTSL; but, in case there’s a better way, or I’m barking up the wrong tree, what I’m actually trying to accomplish is to use the MediaPlaceholder in my new block, and have it open a specific directory (not the default uploads directory). I’ve looked at the upload_dir and wp_handle_upload_prefilter filters, which might work, but I can’t figure out any way to only set them when they’re called by clicking on my block. I’ve also considered adding a new REST endpoint and attaching that to the button, but … it seems like there must be an easier way, so I thought I’d look at this open function before I go down that path.