You can send HTML (or text) content via the __html marker.
If you specify an element ID, the __e marker will represent the element whose id property matches the specified string.
The __map tag creates a Map object holds key-value pairs and remembers the original insertion order of the keys.
The __set tag creates a Set object that lets you store unique values.
namespace App\Http\Controllers;
use App\Models\User;
use dobron\BigPipe\TransportMarker;
use dobron\BigPipe\AsyncResponse;
class UsersController extends Controller
{
private $response;
public function __construct(AsyncResponse $response)
{
$this->response = $response;
}
public function insights()
{
...
$this->response->bigPipe()->require("require('Chart').setup()", [
'element' => TransportMarker::transportElement('chart-div'),
'dataPoints' => $this->response->transport()->transportSet([
['x' => 10, 'y' => 71],
['x' => 20, 'y' => 55],
['x' => 30, 'y' => 50],
['x' => 40, 'y' => 65],
]),
]);
return $this->response->send();
}
}
Through transport markers you can send HTML content but also transform the content into JavaScript objects (such as Map, Set or Element).