Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
abrin committed Jun 10, 2024
1 parent 30e90ea commit 72dafb3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/modules/popmotion-controller/popmotion-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,14 @@ export const popmotionController = (config: PopmotionControllerConfig = {}): Run
// }
// }

/**
* Resets the event state after the gesture of behavior has finished
*/
function resetState() {
currentDistance = 0;
intent = '';
setDataAttribute();
setDataAttribute(undefined, 'notice');
touchStartTime = 0;
}

Expand Down Expand Up @@ -264,6 +268,12 @@ export const popmotionController = (config: PopmotionControllerConfig = {}): Run
}
}

/**
* Sets a data attribute to expose the current intent/behavior/note to the user
*
* @param value {string} - the data-attribute value
* @param dataAttribute {string} - the data-attribute name
*/
function setDataAttribute(value?: string, dataAttribute = 'intent') {
if (parentElement) {
parentElement.dataset[dataAttribute] = value;
Expand Down

0 comments on commit 72dafb3

Please sign in to comment.