svg.js icon indicating copy to clipboard operation
svg.js copied to clipboard

Missing exports for window functions

Open pjbatista opened this issue 5 years ago • 4 comments

The following functions from "window.js" are not exported by the module and therefore are unusable outside its own source code: getWindow, restoreWindow, saveWindow, and withWindow. These would be very useful for scoping (e.g. manipulating several SVG files using multiple window contexts), specially when working with svgdom.

Currently, the only export from "window.js" is the function registerWindow:

// main.js
export { registerWindow } from './utils/window.js'

Adding the remaining functions to the "main.js" and "svg.js.d.ts" files would solve this issue.

pjbatista avatar May 31 '20 15:05 pjbatista

Actually I only added these extra functions for testing. I thougt when someone is so advancd to use these functions they can just import them from window.js directly. But I guess you are right.

Do you mind creating a PR?

Fuzzyma avatar May 31 '20 21:05 Fuzzyma

Sure! I made the changes on: https://github.com/pjbatista/svg.js/tree/1124-window-exports. Do I also have to bump the version on package.json before submitting the PR or do you do that on your end?

pjbatista avatar Jun 01 '20 12:06 pjbatista

Version bumping is not required. There are almost always multiple changes for the next release and I do it right before the release (also because I cant publish it by accident with an already existing version number)

Fuzzyma avatar Jun 02 '20 08:06 Fuzzyma

PR created: https://github.com/svgdotjs/svg.js/pull/1126

pjbatista avatar Jun 02 '20 12:06 pjbatista