GitHub

Transport Markers

TRANSPORT API
  • transportHtml

    You can send HTML (or text) content via the __html marker.

  • transportElement

    If you specify an element ID, the __e marker will represent the element whose id property matches the specified string.

  • transportMap

    The __map tag creates a Map object holds key-value pairs and remembers the original insertion order of the keys.

  • transportSet

    The __set tag creates a Set object that lets you store unique values.

Controller.php
namespace App\Http\Controllers;

use App\Arch\BigPipe\AsyncResponse;
use dobron\BigPipe\TransportMarker;

class InsightsController extends Controller
{
    public function chart()
    {
        ...

        return (new AsyncResponse())
            ->call('Chart', 'setup', [
                'element' => TransportMarker::element('chart-div'),
                'dataPoints' => TransportMarker::set([
                    ['x' => 10, 'y' => 71],
                    ['x' => 20, 'y' => 55],
                    ['x' => 30, 'y' => 50],
                    ['x' => 40, 'y' => 65],
                ]),
            ])
            ->send();
    }
}
Try it

The same lines are in the console of the developer tools.

Map, Set and Element from PHP

Transport markers turn values of the response into JavaScript objects: the module gets an Element, a Map and a Set, and logs them to the console.