Socket
Socket
Sign inDemoInstall

@superrb/kunstmaan-addons-messaging-service

Package Overview
Dependencies
2
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @superrb/kunstmaan-addons-messaging-service

Messaging service for use on Kunstmaan front end


Version published
Maintainers
2
Install size
63.8 kB
Created

Readme

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

Last updated on 08 Sep 2020

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc