Home Reference Source Repository
import WriteStream from 'postscribe/src/write-stream.js'
public class | source

WriteStream

Stream static html to an element, where "static html" denotes "html without scripts".

This class maintains a history of writes devoid of any attributes or "proxy history".

Injecting the proxy history into a temporary div has no side-effects, other than to create proxy elements for previously written elements.

Given the staticHtml of a new write, a tempDiv's innerHTML is set to proxy_history + staticHtml. The structure of tempDiv's contents, (i.e., the placement of new nodes beside or inside of proxy elements), reflects the DOM structure that would have resulted if all writes had been squashed into a single write.

For each descendent node of tempDiv whose parentNode is a proxy, node is appended to the corresponding real element within the DOM.

Proxy elements are mapped to actual elements in the DOM by injecting a data-id attribute into each start tag in staticHtml.

Constructor Summary

Public Constructor
public

constructor(root: Object, options: Object)

Constructor.

Member Summary

Public Members
public

actuals: *

public
public

doc: *

public

options: *

public

parser: *

public
public
public

root: *

public
public

win: *

public

Method Summary

Public Methods
public

write(str: ...String)

Writes the given strings.

Public Constructors

public constructor(root: Object, options: Object) source

Constructor.

Params:

NameTypeAttributeDescription
root Object

The root element

options Object
  • nullable: true

The options

Public Members

public actuals: * source

public deferredRemote: * source

public doc: * source

public options: * source

public parser: * source

public proxyHistory: string source

public proxyRoot: * source

public root: * source

public scriptStack: * source

public win: * source

public writeQueue: * source

Public Methods

public write(str: ...String) source

Writes the given strings.

Params:

NameTypeAttributeDescription
str ...String

The strings to write