Store initialization

The final section of code in the file initializes the store:

/**
* This function instantiates the Wasm module, fetches the transactions
* from the API endpoint, and loads them into state and the Wasm
* instance.
*/
export const initializeStore = async () => {
const wasmTransactions = new WasmTransactions();
store.wasm = await wasmTransactions.initialize();
const transactions = await apiFetchTransactions();
store.populateTransactions(transactions);
};

The initializeStore() function instantiates the Wasm module, fetches all transactions from the API, and populates the contents of state. This function is called from the application loading code in /src/main.js, which we'll cover in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset