-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
Expected Behavior
Loading beedle from unpkg.com CDN directly on browser
Actual Behavior
This error is reported: Uncaught ReferenceError: Store is not defined
Steps to Reproduce the Problem
<script src="//unpkg.com/beedle"></script> <textarea></textarea> <script> const actions = { saySomething(context, payload) { context.commit('setMessage', payload); } }; const mutations = { setMessage(state, payload) { state.message = payload; return state; } }; const initialState = { message: 'Hello, world' }; const storeInstance = new Store({ actions, mutations, initialState }); const textElement = document.querySelector('textarea'); textElement.addEventListener('input', () => { // Dispatch the action, which will subsequently pass this message to the mutation // which in turn, updates the store's state storeInstance.dispatch('saySomething', textElement.value.trim()); }); // Grab the text element and attach it to the stateChange event const messageElement = document.querySelector('.js-message-element'); // This fires every time the state updates storeInstance.subscribe(state => { messageElement.innerText = state.message; }); </script>My Browser link(s)
Metadata
Metadata
Assignees
Labels
No labels