src/preact/base-element.js
/**
   * Creates a wrapper around a Preact ref. The API surface exposed by this ref
   * **must** be consistent accross all rerenders.
   *
   * This wrapper is necessary because every time React rerenders, it creates
   * (depending on deps checking) a new imperative handle and sets that to
   * `ref.current`. So if we ever returned `ref.current` directly, it could go
   * stale by the time its actually used.
   *
   * @param {!API_TYPE} current
   * @private
   */
Creates a wrapper around a Preact ref. The API surface exposed by this ref
must** be consistent accross all rerenders.

This wrapper is necessary because every time React rerenders, it creates
(depending on deps checking) a new imperative handle and sets that to
`ref.current`. So if we ever returned `ref.current` directly, it could go
stale by the time its actually used.

@param {!API_TYPE} current
@private
Creates a wrapper around a Preact ref . The API surface exposed by this ref must ** be consistent accross all rerenders . This wrapper is necessary because every time React rerenders it creates ( depending on deps checking ) a new imperative handle and sets that to ` ref . current ` . So if we ever returned ` ref . current ` directly it could go stale by the time its actually used . @param { !API_TYPE } current @private
initApiWrapper_(current) {
    const api = map();
    const keys = Object.keys(current);
    for (let i = 0; i < keys.length; i++) {
      const key = keys[i];
      wrapRefProperty(this, api, key);
    }
    this.apiWrapper_ = api;
    if (this.deferredApi_) {
      this.deferredApi_.resolve(api);
      this.deferredApi_ = null;
    }
  }
initApiWrapper_ ( current ) { const api = map ( ) ; const keys = Object . keys ( current ) ; for ( let i = 0 ; i < keys . length ; i ++ ) { const key = keys [ i ] ; wrapRefProperty ( this , api , key ) ; } this . apiWrapper_ = api ; if ( this . deferredApi_ ) { this . deferredApi_ . resolve ( api ) ; this . deferredApi_ = null ; } }
Creates a wrapper around a Preact ref.
Creates a wrapper around a Preact ref .