react/packages/react-noop-renderer/npm/flight-modules.js
Sebastian Markbåge a56309fb88
[Flight] Integrate Blocks into Flight (#18371)
* Resolve Server-side Blocks instead of Components

React elements should no longer be used to extract arbitrary data but only
for prerendering trees.

Blocks are used to create asynchronous behavior.

* Resolve Blocks in the Client

* Tests

* Bug fix relay JSON traversal

It's supposed to pass the original object and not the new one.

* Lint

* Move Noop Module Test Helpers to top level entry points

This module has shared state. It needs to be external from builds.

This lets us test the built versions of the Noop renderer.
2020-03-23 17:53:45 -07:00

17 lines
444 B
JavaScript

'use strict';
// This file is used as temporary storage for modules generated in Flight tests.
var moduleIdx = 0;
var modules = new Map();
// This simulates what the compiler will do when it replaces render functions with server blocks.
exports.saveModule = function saveModule(render) {
var idx = '' + moduleIdx++;
modules.set(idx, render);
return idx;
};
exports.readModule = function readModule(idx) {
return modules.get(idx);
};