Skip to content

Commit

Permalink
further improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
KingSora committed Jun 10, 2024
1 parent f593922 commit 3163809
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions packages/overlayscrollbars/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,9 @@ const createEnvironment = (): Env => {
return env;
};

const getEnvironment = (): Env => {
export const getEnvironment = (): Env => {
if (!environmentInstance) {
environmentInstance = createEnvironment();
}
return environmentInstance;
};

export { getEnvironment };
18 changes: 9 additions & 9 deletions packages/overlayscrollbars/src/support/dom/manipulation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { NodeElementTarget, NodeElementTargetCollection } from './types';
import { createOrKeepArray, each } from '../utils/array';
import { parent } from './traversal';
import { bind, noop } from '../utils';
import { bind } from '../utils';

/**
* Removes the given Nodes from their parent.
Expand All @@ -21,11 +21,11 @@ export const removeElements = (nodes: NodeElementTargetCollection): void => {
* @returns A function which removes the inserted nodes.
*/
export const appendChildren = (node: NodeElementTarget, children: NodeElementTargetCollection) =>
node && children
? bind(
removeElements,
each(createOrKeepArray(children), (child) => {
child && node.appendChild(child);
})
)
: noop;
bind(
removeElements,
node &&
children &&
each(createOrKeepArray(children), (child) => {
child && node.appendChild(child);
})
);

0 comments on commit 3163809

Please sign in to comment.