0.2.0 • Published 14 days ago

@marshallku/react-postscribe v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
14 days ago

@marshallku/react-postscribe

License NPM Version Known Vulnerabilities NPM Downloads

React component to render HTML with postscribe.


Inspired by react-postscribe.

  • Add TypeScript support (both postscribe and react-postscribe)
  • Update version of React
  • Refactor to function component
  • Remove lodash

Made for better albamon mobile MSA

Install

npm install @marshallku/postscribe
# or
yarn add @marshallku/postscribe

Usage

import PostScribe from "@marshallku/react-postscribe";

function AdBanner() {
    return (
        <div className="ad-banner">
            <PostScribe html={`<script src="https://example.com/"></script>`} />
        </div>
    );
}

export default AdBanner;

Props

PropertyTyperequiredDescription
htmlstringtrueAn html string or a function that takes a DOM Document and writes to it.
afterAsync() => voidfalseA callback called when an async script has loaded
afterDequeue() => voidfalseA callback called immediately before removing from the write queue
afterStreamStart() => voidfalseA callback called sync after a stream's first thread release
afterWrite() => voidfalseA callback called after writing buffered document.write calls
done() => voidfalseA callback that will be called when writing is finished
autoFixbooleanfalseA boolean that allows disabling the autoFix feature of prescribe
beforeEnqueue() => voidfalseA callback called immediately before adding to the write queue
beforeWrite() => voidfalseA callback called before writing buffered document.write calls
beforeWriteToken() => voidfalseA callback called before writing a token
error() => voidfalseA function that throws the error by default, but could be overwritten
releaseAsyncbooleanfalseA boolean whether to let scripts w/ async attribute set fall out of the queue
0.2.0

14 days ago

0.1.11

11 months ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.9

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago