Skip to content

Commit

Permalink
up guide
Browse files Browse the repository at this point in the history
  • Loading branch information
uNmAnNeR committed Jul 19, 2023
1 parent b09b2da commit 0256f08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/css/highlight.css
@@ -1,5 +1,5 @@
.highlight { background-color: rgba(55, 148, 222, 0.05) }
.highlight pre code { background: none; color: #5d5d5d }
.highlight pre code { background: none; color: #404040 }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #aaaaaa; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #FF0000 } /* Error */
Expand Down Expand Up @@ -28,7 +28,7 @@
.highlight .m { color: #929292 } /* Literal.Number */
.highlight .s { color: #006c00 } /* Literal.String */
/*.highlight .na { color: #7D9029 } /* Name.Attribute */
.highlight .nb { color: #75a6d7; letter-spacing: 0.03em; } /* Name.Builtin */
.highlight .nb { color: #598cc0; letter-spacing: 0.03em; } /* Name.Builtin */
.highlight .nc { color: #0000FF; font-weight: bold; letter-spacing: 0.03em; } /* Name.Class */
.highlight .no { color: #880000 } /* Name.Constant */
.highlight .nd { color: #AA22FF } /* Name.Decorator */
Expand Down
25 changes: 13 additions & 12 deletions docs/guide.html
Expand Up @@ -59,20 +59,20 @@ <h2 id="getting-started" class="section-h"><a href="#getting-started">Getting St

<p>Get/set value and unmasked value:</p>
{% highlight javascript %}
mask.value = "+7(999)999-99-99";
console.log(mask.value); // "+7(999)999-99-99"
console.log(mask.unmaskedValue); // "79999999999"
mask.value = '+7(999)999-99-99';
console.log(mask.value); // '+7(999)999-99-99'
console.log(mask.unmaskedValue); // '79999999999'

mask.unmaskedValue = "70000000000";
console.log(mask.value); // "+7(000)000-00-00"
console.log(mask.unmaskedValue); // "70000000000"
mask.unmaskedValue = '70000000000';
console.log(mask.value); // '+7(000)000-00-00'
console.log(mask.unmaskedValue); // '70000000000'
{% endhighlight %}

<p>For typed masks like <code>Number</code> or <code>Date</code> it is possible to work with typed values:</p>
{% highlight javascript %}mask.updateOptions({mask: Number});
mask.typedValue = 100; // use number
console.log(mask.value); // "100"
console.log(mask.unmaskedValue); // "100"
console.log(mask.value); // '100'
console.log(mask.unmaskedValue); // '100'
console.log(mask.typedValue); // 100
{% endhighlight %}
<p>For untyped masks <code>typedValue</code> and <code>unmaskedValue</code> works identically.</p>
Expand All @@ -93,20 +93,21 @@ <h2 id="getting-started" class="section-h"><a href="#getting-started">Getting St

<p>Listen to events:</p>
{% highlight javascript %}
const log = () => console.log(mask.value);
// 'accept' event fired on input when mask value has changed
mask.on("accept", () => console.log(mask.value));
mask.on('accept', log);

// 'complete' event fired when the value is completely filled
// Note: this makes sense only for Pattern-based masks
mask.on("complete", () => console.log(mask.value));
mask.on('complete', () => console.log(mask.value));
{% endhighlight %}

<p>Stop listening to events:</p>
{% highlight javascript %}
mask.off("accept", log);
mask.off('accept', log);

// omit handler argument to unbind all handlers
mask.off("complete");
mask.off('complete');
{% endhighlight %}

<p>Get <code>Masked</code> model:</p>
Expand Down

0 comments on commit 0256f08

Please sign in to comment.