-
Lightweight browser utilities for event management, and window operations in modern JavaScript applications.
-
install
hmmfirst.hmm i @minejs/browser
-
import { WindowManager, EventsManager } from '@minejs/browser'
-
import { WindowManager } from '@minejs/browser' const windowManager = new WindowManager() // Responsive viewport tracking const viewport = windowManager.getViewport() if (viewport().isMobile) { // Handle mobile layout } // Theme management windowManager.setTheme('dark') // Local storage helpers windowManager.setStorage('user', { name: 'John' })
-
import { EventsManager } from '@minejs/browser' const events = new EventsManager() // Bind event with auto cleanup const unbind = events.on(window, 'scroll', () => { console.log('Scrolled!') }) // Unbind when done unbind() // Auto cleanup events.destroy()
-
-
-
-
DOM utilities for viewport tracking, scroll management, theme switching, local storage, meta tags, and element utilities.
-
Efficient event binding and cleanup with automatic reference tracking and batch unbinding capabilities.
-
-
-
import { createRouter, useRoute, WindowManager } from '@minejs/browser' const windowManager = new WindowManager() const router = createRouter({ routes: [ { path: '/dashboard', component: () => DashboardPage, meta: { title: 'Dashboard' } }, { path: '/products/:id', component: () => ProductPage, loader: async (ctx) => { return await fetchProduct(ctx.params.id) } } ], scrollBehavior: 'smooth' }) // Setup guards router.beforeEach((to, from) => { if (to.path === '/admin' && !isAuthed()) return false return true }) // Navigation router.push('/dashboard') // Monitor viewport const viewport = windowManager.getViewport() console.log(viewport().isDesktop) // true
-
import { EventsManager } from '@minejs/browser' const events = new EventsManager() // Bind multiple events events.on(document, 'click', handleClick) events.on(window, 'resize', handleResize) events.on(window, 'scroll', handleScroll, { passive: true }) // Later: cleanup everything events.destroy() // All listeners removed automatically
-

