Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
JSDoc for the directive
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Lyashuk committed Mar 5, 2017
1 parent ac48edd commit 454ee3f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,36 @@ function updateHandler(el, mask){
*/
export default function (Vue) {
Vue.directive('mask', {

/**
* Called only once, when the directive is first bound to the element.
* This is where you can do one-time setup work.
*
* @param {HTMLInputElement} el
* @param {?String} value
*/
bind (el, {value}) {
bindHandler(el, value);
},

/**
* Called only once, when the directive is unbound from the element.
*/
unbind: unbindHandler,

/**
* Called after the containing component has updated,
* but possibly before its children have updated.
* The directive’s value may or may not have changed,
* but you can skip unnecessary updates by comparing the
* binding’s current and old values.
*
* @param {HTMLInputElement} el
* @param {?String} value
* @param {?String} oldValue
*/
update(el, {value, oldValue}){
// if mask was changed
// if mask was not changed - do nothing
if (value === oldValue) return;

updateHandler(el, value)
Expand Down

0 comments on commit 454ee3f

Please sign in to comment.