mmnn

API Reference

Comprehensive documentation of mmnn's API including core modules, authentication, error handling and system patterns.

Core Modules

createApp()

Initializes a new mmnn application instance with root element, options, and plugins

const app = createApp({
  el: '#app',
  state: { 
    theme: localStorage.getItem('theme') || 'dark',
    user: null
  },
  plugins: [LoggerPlugin, StateSyncPlugin]
});
Returns: AppInstance

useAPI()

Creates a typed API client for interacting with backend services

const userAPI = useAPI('/user', {
  headers: {
    'Authorization': 'Bearer ' + auth.getToken()
  }
});
Returns: APIClient

Authentication

auth.login()

Authenticates the user with provided credentials and persists the session

auth.login({
  email: 'user@example.com',
  password: 'yourSecurePassword'
}).then(user => {
  // Store access token
  auth.setToken(user.accessToken);
});
Returns: User|undefined

Error Handling

handleAPIError()

Standardized error processing for mmnn API requests

try {
  const response = await userAPI.get('/profile');
} catch (error) {
  handleAPIError(error);
  // Will show appropriate error notification
  // and log to console for debugging
}
Returns: void

Library Overview

Key Concepts

  • Reactive state management with auto-updating templates
  • Built-in service discovery and dependency injection
  • Real-time data binding with computed properties

Ecosystem

  • mmnn-CLI for instant project scaffolding
  • StateSync - Cross-tab state synchronization
  • LoggerPlugin - Advanced debugging tools