Introduction to Now.js
- Home
- Documentation
- Getting Started
- Introduction to Now.js
What is Now.js?
Now.js is a lightweight, modern JavaScript framework designed for building rich web applications. It combines the best practices of modern web development with a simple and intuitive API.
Lightweight
No dependencies and minimal footprint
Component-Based
Build UIs with reusable, encapsulated components
Modern Features
Built-in routing, state management, and more
Key Features
- Component SystemCreate reusable UI components
- State ManagementCentralized application state
- RoutingClient-side routing with history support
- Event SystemPowerful event handling
- InternationalizationBuilt-in i18n support
- Theme SystemDark mode and custom themes
- Server IntegrationWorks with any backend
Quick Example
Here's a simple example of creating a component with Now.js
// Counter component
Now.getManager('component').define('counter', {
// Component template
template: `
<div class="counter">
<h2>{{title}}</h2>
<div class="counter-controls">
<button class="button blue large" data-on="click:decrement">-</button>
<span class="counter-value">{{count}}</span>
<button class="button blue large" data-on="click:increment">+</button>
</div>
<p class="counter-text">Current count: {{count}}</p>
</div>
`,
// Component state
state: {
title: 'Counter Component',
count: 0
},
// Component methods
methods: {
increment() {
this.state.count++;
this.render();
},
decrement() {
this.state.count--;
this.render();
}
},
// Lifecycle hooks
mounted() {
console.log('Counter component mounted');
},
// Event handlers
events: {
'counter:reset': function() {
this.state.count = 0;
this.render();
}
}
});
Then use it in your HTML
<div data-component="counter"></div>
Why Now.js?
Simple but Powerful
Now.js provides powerful features while maintaining simplicity. No complex build tools or configuration required.
Performance First
Built with performance in mind, Now.js is optimized for both initial load and runtime performance.
Modern Development
Supports modern development practices and patterns while remaining easy to learn and use.
Browser Support
Now.js supports all modern browsers including
- Chrome (last 2 versions)
- Firefox (last 2 versions)
- Safari (last 2 versions)
- Edge (last 2 versions)
- Opera (last 2 versions)
Getting Started
Ready to start building with Now.js? Choose your path