Skip to content

Commit

Permalink
feat: ✨ add destroy helper for sodesu
Browse files Browse the repository at this point in the history
  • Loading branch information
BeiyanYunyi committed Dec 21, 2024
1 parent 228730c commit 0cac73b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ import configProvider from './controllers/configProvider';
import 'virtual:uno.css';

const Sodesu = {
root: undefined as HTMLElement | undefined,
init: (opt: SodesuInitOptions) => {
const root = configProvider.init(opt);
render(() => <App />, root);
Sodesu.root = configProvider.init(opt);
render(() => <App />, Sodesu.root!);
},
update: (opt: Partial<Omit<SodesuInitOptions, 'el'>>) => {
configProvider.update(opt);
},
destroy: () => {
if (Sodesu.root) Sodesu.root.innerHTML = '';
},
};

export default Sodesu;

0 comments on commit 0cac73b

Please sign in to comment.