JSHelper (in progress)
Import the Helper
To import the helper, import all functions from the EconsorHelper class in the EconsorSetup Plugin. Give it any alias you want. We will use "ec" here. The import will now look something like this:
import * as ec from "../../../../../../../EconsorSetup/src/Resources/app/storefront/src/js/EconsorHelper"
Helper Methods
The Helper itself has these Methods, which you can call with the alias you used.
?> Usage example: ec.all('.myClass').closest('.wrapper').load() Where "ec" is the alias from your import. Since we get DOM Objects from "all" we can chain DOM Object methods immediately after.
all()
Returns all found DOM Elements as EconsorDOMObjects in an Array.
Parameters:
query: The DOM Selector, for example div.image-wrapperparent(Optional): Define a parent node, in which i want to search.
Useage:
ec.all('.image', wrapper);
get()
Returns one DOM Element as an EconsorDOMObject.
Parameters:
query: The DOM Selector, for example div.image-wrapperparent(Optional): Define a parent node, in which i want to search.
Useage:
ec.get('.image', wrapper);
makeObject()
Converts a DOM Element into an EconsorDOMObject.
Parameters:
DOM Node: The Node you want to convert
Useage:
ec.makeObject(DomAccess.querySelector('#example-wrapper'));