UNPKG

bigpipe-util

Version:

This library currently implements small part of Facebook BigPipe so far, but the advantage is to efficiently insert/replace content and work with the DOM. It is also possible to easily call JavaScript modules from PHP.

22 lines (17 loc) 452 B
import AsyncDOM from "./AsyncDOM"; import ServerJS from "../ServerJS"; const _AsyncDOM = new AsyncDOM; const _ServerJS = new ServerJS; export default class AsyncResponse { handle(response, element) { const {domops, jsmods} = response; if (typeof response === 'object') { if (domops) { _AsyncDOM.invoke(domops, element); } if (jsmods) { _ServerJS.handle(jsmods); } } } };