import * as React from 'react' ; import OlMap from 'ol/Map' ; import * as PropTypes from 'prop-types' ; import Logger from '@terrestris/base-util/dist/Logger' ; export interface export interface MapProviderProps { /**
     * The map can be either an OlMap or a Promise that resolves with an OlMap
     * if your map is created asynchronously.
     */ map : OlMap | Promise < OlMap > ; } interface MapProviderState { map ? : OlMap ; ready : boolean ; } /**
 * The MapProvider.
 */ class MapProvider extends React . Component < MapProviderProps , MapProviderState > { /**
     * The child context types.
     */ static childContextTypes = { map : PropTypes . instanceOf ( OlMap ) } ; constructs param props constructor ( props ) { Logger . warn ( 'MapProvider is deprecated and might be removed in an upcoming major release. ' + 'Please consider to use the MapContext.' ) ; super ( props ) ; this . state = { map : null , ready : false } ; Promise . resolve ( props . map ) . then ( ( map ) => { this . setState ( { map : map , ready : true } ) ; } ) ; } return getChildContext ( ) { const { map } = this . state ; return { map } ; } /**
     * The render function.
     */ render ( ) { if ( ! this . state . ready ) { return null ; } else { return this . props . children ; } } } export default MapProvider ;