chat-window

WebJar for chat-window

License

License

MIT
GroupId

GroupId

org.webjars.bowergithub.jifalops
ArtifactId

ArtifactId

chat-window
Last Version

Last Version

0.6.1
Release Date

Release Date

Type

Type

jar
Description

Description

chat-window
WebJar for chat-window
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/jifalops/chat-window

Download chat-window

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.jifalops/chat-window/ -->
<dependency>
    <groupId>org.webjars.bowergithub.jifalops</groupId>
    <artifactId>chat-window</artifactId>
    <version>0.6.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.jifalops/chat-window/
implementation 'org.webjars.bowergithub.jifalops:chat-window:0.6.1'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.jifalops/chat-window/
implementation ("org.webjars.bowergithub.jifalops:chat-window:0.6.1")
'org.webjars.bowergithub.jifalops:chat-window:jar:0.6.1'
<dependency org="org.webjars.bowergithub.jifalops" name="chat-window" rev="0.6.1">
  <artifact name="chat-window" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.jifalops', module='chat-window', version='0.6.1')
)
libraryDependencies += "org.webjars.bowergithub.jifalops" % "chat-window" % "0.6.1"
[org.webjars.bowergithub.jifalops/chat-window "0.6.1"]

Dependencies

compile (8)

Group / Artifact Type Version
org.webjars.bowergithub.polymer : polymer jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : iron-icon jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : paper-input jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : iron-flex-layout jar [2.0.0,3)
org.webjars.bowergithub.jifalops : from-now jar [0.4.0,0.5)
org.webjars.bowergithub.polymerelements : paper-styles jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : paper-icon-button jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : iron-icons jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

Published on Vaadin  Directory Stars on vaadin.com/directory Published on webcomponents.org

chat-window

The easiest way to have a chat.

Installation

bower i -S chat-window        # Polymer 2.0 hybrid (1.x compatible)
bower i -S chat-window#0.5.0  # Polymer 1.x based

Usage

  • Pass it a list of messages and it will display them with live relative timestamps using from-now.
  • Listen for the send event to handle sending messages.

Demo

Mouse-over messages to see the absolute timestamp.

<chat-window
  id="chat"
  author="me"
  single-line>
</chat-window>
<script>
  var chat = document.getElementById('chat');
  var author;
  chat.messages = messages;
  chat.addEventListener('send', function(e) {
    author = author == 'me' ? 'you' : 'me'; // For demo
    chat.push('messages',{
      author: author,
      text: e.detail,
      created: Date.now()
    });
    chat.inputText = '';
  });
</script>

Full demo: webcomponents.org | github.

API: webcomponents.org | github.

Features

  • Single or multi line input.
  • Send-on-enter option, default is on for single-line and off for multi-line input.
  • Slots for a header, footer, and a custom input field.
  • Styling hooks for full styling flexibility
  • Automatically scrolls to bottom when a new message arrives (can be disabled).
  • Absolute timestamps can be shown via configurable date format.
  • Auto-updating message timestamps using Moment.js that
    • Show every 5 minutes if less than one hour old,
    • Show every hour if less than a day old,
    • Show every four hours if a less than a week old,
    • Otherwise show once per day.

TODO

  • Allow author: msg format instead of alignment based format.
  • Use material guidelines for showing relative vs absolute timestamps as well as their format.

Contributing

  1. Fork it on Github.
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

License

MIT

Versions

Version
0.6.1