svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
11.04k stars 1.08k forks source link

Missing exports for window functions #1124

Closed pjbatista closed 1 year ago

pjbatista commented 4 years ago

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.

Fuzzyma commented 4 years ago

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?

pjbatista commented 4 years ago

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?

Fuzzyma commented 4 years ago

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)

pjbatista commented 4 years ago

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