force-app/main/lwcApi/lwcApi.js
/**
     * For internal use.
     * Returns a promise waiting for the parent-child postmate request to complete
     * then resolves with response from the child iframe.
     */
For internal use.
Returns a promise waiting for the parent-child postmate request to complete
then resolves with response from the child iframe.
For internal use . Returns a promise waiting for the parent - child postmate request to complete then resolves with response from the child iframe .
makePenpalRequest(requestType, child, request) {
        var p;
        if (requestType === 'rest') {
            p = child.restRequest(request);
        } else if (requestType === 'fetch') {
            p = child.fetchRequest(request);
        } else {
            p = Promise.resolve({
                success: false,
                data: 'LWC_API: Invalid request type: ' + requestType
            });
        }
        return p.then(function (response) {
            if (response.success) {
                return response.data;
            }
            throw new Error(response.data);
        });
    }
makePenpalRequest ( requestType , child , request ) { var p ; if ( requestType === 'rest' ) { p = child . restRequest ( request ) ; } else if ( requestType === 'fetch' ) { p = child . fetchRequest ( request ) ; } else { p = Promise . resolve ( { success : false , data : 'LWC_API: Invalid request type: ' + requestType } ) ; } return p . then ( function ( response ) { if ( response . success ) { return response . data ; } throw new Error ( response . data ) ; } ) ; }
For internal use.
For internal use .