npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-simple-chat

v1.0.11

Published

AngularJS chat directive

Downloads

57

Readme

angular-simple-chat

devdependencies Build Status codecov.io bower

AngularJS chat directive

AngularJS chat directive

Requirements

"dependencies": {
  "angularjs": "~1.4.9"
}

angular-moment amTimeAgo copied internaly because of unit testing issue with angular-moment AMD configuration

Installation

Install with Bower

bower install --save angular-simple-chat

Add the dependencies to your index.html manually or using tool like wiredep

<!-- Dependencies -->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/moment/moment.js"></script>
<script src="bower_components/angular-moment/angular-moment.js"></script>

<!-- Simple Chat -->
<link rel="stylesheet" href="bower_components/angular-simple-chat/dist/angular-simple-chat.min.css">
<script src="bower_components/angular-simple-chat/dist/angular-simple-chat.min.js"></script>

Load the module in your app

angular.module('app', ['angular-simple-chat']);

Use it in any template

<simple-chat
    messages="AppView.messages"
    local-user="AppView.you"
></simple-chat>

Interaction

The component is just responsable of displaying messages, and writing them. The synchronisation between different clients is not implemented.

Running the examples

To run the examples page, just run

gulp serve

and open your browser on http://localhost:3000/examples/

Description of attributes

| Attribute | Description | Required | Type | Binding | | :------------- |:-------------| :-----:| :-----:| :-----:| | messages | array of messages to show. Message format is : {id: 'string', text: 'string', userId: 'string', date: '1455120273886'}| Yes | Array | = | | local-user | user object of the user using the chat. {userId: 'string', avatar: 'string', userName: 'string'}| Yes | Object | = | | send-function | function called when user click on send button | No | Function | = | | live-flag-function | function called to submit flags | No | Function | = | | live-mode | configure live mode | No | Boolean | = | | send-button-text | init send button text | No | String | @ | | composer-placeholder-text | init composer placeholder text | No | String | @ | | show-user-avatar | show/hide user avatar | No | Boolean | = | | show-composer | show/hide composer | No | Boolean | = | | show-bubble-infos | show/hide bubble infos | No | Boolean | = |

Events

simple-chat-message-posted

Event sended when local user send a message

Live mode

While the first user is writing text on his side, the other user received directly the letters. The end of the bubble is catched when "Enter" key is pressed. Flags are sended with liveFlagFunction to explain sequence who people writing text :

  • startSentence
  • endSentence

TODOS

  • Display message "time ago" with these rules :
    • if message.date < 1 week && < 3 days ago : display " today/yesterday/the day before yesterday + HH:mm "
    • if message.date < 1 week && > 3 days ago : display " day + HH:mm "
    • if message.date > 1 week : display " day. X month (YYYY) + HH:mm "

Tests

In terminal

  • run chromedriver in one tab :
chromedriver  --port=4444 --url-base=wd/hub
  • run tests in another one :

With gulp

gulp tests

With npm

npm run test-local-terminal

In a browser

Access this url :

http://YOUR_LOCAL_WEBSERVER/angular-simple-chat/node_modules/intern/client.html?config=tests/intern.local.browser