virtualcontent

Browser tool designed for lazy rendering large text/html content

Usage no npm install needed!

<script type="module">
  import virtualcontent from 'https://cdn.skypack.dev/virtualcontent';
</script>

README

VirtualContent

VirtualContent - is a browser tool designed for handling large text/html content.

Installation

npm i --save virtualcontent

Usage

import "VC" from "virtualcontent";

VC.create(options).setText(str).renderTo($container);

Options

ParameterAcceptsDefault valueDescription
appendBoolfalseSwitch to Append mode (Replace mode is the default)
chunkPreProcessorFunctionnullSet function which receives chunk (String) as a first argument, and returns String.
delayInteger100Delay scroll processing.
lengthNumber10240Set maximum length for a chunk string
scrollableParentNode/jQueryEl/selectorundefinedSet scrollable parent node.
thresholdNumber2It defines how much chunks are shown at once in Replace mode (default)

API

MethodArgumentsReturnsDescription
create (static)optionsNew instanceCreate new VC instance
destroynoneselfDestroy VC instance
renderToNode/jQueryElselfRender to node or $el
setHtmlStringselfSet HTML content
setTextStringselfSet text content