Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/miguelcastillo/semrequirechat


https://github.com/miguelcastillo/semrequirechat

Last synced: 9 days ago
JSON representation

Awesome Lists containing this project

README

        

semRequireChat
==============

SEM.js RequireJS skeleton demo app

1. This application has probably the most basic RequireJS setup you need to know.

2. It has a main.js, which is the main module (entry point) for the app; analogous to main function in other languages.
3. It has an index.html that ties requirejs, requirejs configuration, and the main module.

4. It has a chat module, which connects to semrequirejs.herokuapp.com and is located in common/js/chat.js.

So, why does this even exist? The purpose is really to let folks get aquainted with a RequireJS infrastructure.

Instruction
==============
1. Download the zip.
2. Look at index.html to inspect how things tie together.
3. Open main.js, which is the main module and its currently empty for you to fill in.
4. Define a RequireJS module and import the chat module.
6. Create a chat module instance. new Chat();.
7. Send a message with the send interface.
8. Level up 1: read and display all the messages using the getAll interface.
9. Level up 2: delete a message you have posted. DO NOT USE clearAll!

Chat API
==============
1. Chat is a constructor that optionally takes in a jQuery instance. You don't need to pass anything in, unless you intend to customize where the chat module writes messages to. Instantiate with a code like var chat = new Chat();. Located in common/js/.
2. send is an interface that takes in a message as the first parameter and optionally an email address as the second one. The email address is only used to resolve your picture from avatar.com.
3. get interface that takes in an ID and returns a particular message.
4. getAll interface that returns all messages in the system.
5. clear interface that takes in an ID of a message to delete.