Skip to content

Design Principles

Trevor Fayas edited this page Aug 4, 2021 · 3 revisions

The Generic Ecommerce system was design to have each component relatively agnostic of the other elements, and each piece you can overwrite and adjust.

Client Side Libraries/Events

On the client side of things, Generic Ecommerce contains various repository classes (ecommerce.min.js) that are exposed through the InitializeEcommerceService(type) method. It also contains Event methods which generate CustomEvents.

Then it has the ecommerceEvents.js file which bridges the HTML and user interactions and executes logic on the various repositories.

It does this by using the ecommerce.min.js repository Event methods to dispatch events on the document.body. These events then caught and then the event parameters are used to call the proper method on the repository classes in ecommerce.min.js.

So the process goes:

  1. ecommerceEvents.js interacts with the HTML elements
  2. ecommerceEvents.js dispatches CustomEvents to the document.body, generated through the ecommerce.min.js's libraries
  3. ecommerceEvents.js watches these CustomEvents on the document.body, and calls the execution methods in the ecommerce.min.js's libraries

This allows you to initialize custom events yourself, or append/replace the listeners to these events and perform your own operations.

Server Side Customization

All operations done server-side are done through Interfaces which you can implement your own through dependency injection. Also all View paths are adjustable so you can implement your own Views as well.

Clone this wiki locally