🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@superrb/kunstmaan-addons-messaging-service

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@superrb/kunstmaan-addons-messaging-service

Messaging service for use on Kunstmaan front end

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
2
Created
Source

Kunstmaan Addons Messaging Service

A simple service to allow notification-style messaging on the front end of Kunstmaan CMS websites.

## Installation

yarn add @superrb/kunstmaan-addons-messaging-service

Usage

Add the HTML container somewhere on the page. This will pull messages from Symfony's session flashbag

<ul id="messages" class="messages" data-turbolinks-permanent>
  {% for type, messages in flash %}
    {% for message in messages %}
      <li class="message message--{{ type }}" {% if type != 'error' %}data-timeout="5000"{% endif %}>
        <span class="message__text">
          {{ message | trans }}
        </span>

        <button class="message__close">
          <span class="screenreader-text">Close message</span>
        </button>
      </li>
    {% endfor %}
  {% endfor %}
</ul>

The data-timeout attribute sets a time in ms after which the message will disappear.

### Creating messages

import messagingService from '@superrb/kunstmaan-addons-messaging-service'

// Persistent messages
messagingService.info('This a message')
messagingService.error('This is an error message')
messagingService.warning('This is a warning message')
messagingService.success('This is a success message')

// Auto-hide message after 5 seconds
messagingService.info('This message will hide after 5 seconds', 5000)

// Close all visible messages (handy to call on `turbolinks:visit`)
messagingService.closeAll()

## Authors

  • James Dinsdale (@molovo)

License

FAQs

Package last updated on 08 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts