@mkhuda/dom-screenshot
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

dom-screenshot

Build Status npm version

DOM screenshot by dom-to-image forked & modified from dom-to-image

Install

# YARN
yarn add @mkhuda/dom-screenshot
# NPM
npm install @mkhuda/dom-screenshot

Added & Fix:

  • Change to rollup build
  • Add encodeURIComponent on makeSvgDataUri. Based on this issue
  • Add Typescript support, (.d.ts) battery included.

TODO (on progress):

  • Full rewrite to Typescript
  • Adding chai test (on progress).

Usages (React)

import DomScreenshot from "@mkhuda/dom-screenshot";
....

return(
    <button
        onClick={() => {
          const getElement = document.getElementById("root") as HTMLElement;
          const image = DomScreenshot.toPng(document.body, {});
          image.then((generatedImage) => {
            window.open(generatedImage);
          });
        }}
      >
        Test
    </button>
)
...

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Package Sidebar

Install

npm i @mkhuda/dom-screenshot

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

24.3 kB

Total Files

8

Last publish

Collaborators

  • mkhuda