Get started with stapes CDN

MIT licensed

The Stapes library is a lightweight, modular JS framework for building user interfaces.

Tags:
  • mvc
  • framework
  • lightweight

Stable version

Copied!

How to start using stapes CDN


// Import Stapes library
import Stapes from 'https://cdn.cdnhub.io/stapes/1.0.0/stapes.min.js';

// Initialize Stapes with a default state
const store = new Stapes({
  state: {
    count: 0,
  },
});

// Define actions
store.actions = {
  increment: ({ state, commit }) => {
    commit('SET_COUNT', state.count + 1);
  },
};

// Define mutations
store.mutations = {
  SET_COUNT(state, newCount) {
    state.count = newCount;
  },
};

// Dispatch an action
store.dispatch('increment');

// Get the updated state
console.log(store.state.count); // Output: 1
Copied!
Copied!

All versions