@sms77.io/counter

Counts the SMS character usage in browser as well as NodeJS environments.

Usage no npm install needed!

<script type="module">
  import sms77IoCounter from 'https://cdn.skypack.dev/@sms77.io/counter';
</script>

README

sms77io Logo

SMS Counter by Sms77

Installation

  • For Browsers

    <script src="https://unpkg.com/@sms77.io/counter/dist/index.js"></script>
    
  • For NodeJS

    yarn add @sms77.io/counter
    
     import '@sms77.io/counter'
    

Usage

<textarea data-sms77-sms></textarea>

For advanced usage see the example.

Options

Set the window object before loading the library.

window.SMS77IO_COUNTER_OPTIONS = {
            initEvent: string = 'DOMContentLoaded', // the DOM event for init
            position: InsertPosition = 'afterend', // where to add the counter span
            selector: string = 'textarea[data-sms77-sms]', // the inputs selector
            standalone: boolean = false, // stop attaching input listeners
            stats: boolean = false, // whether to output stats or not
    }