Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1 from ngoldman/little-things
Browse files Browse the repository at this point in the history
little things
  • Loading branch information
ungoldman committed Apr 26, 2015
2 parents ef307f5 + e659e33 commit ec2d910
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 20 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
@@ -0,0 +1,9 @@
language: node_js
node_js:
- 'iojs'
sudo: false
cache:
directories:
- node_modules
script:
- npm test
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,4 +1,4 @@
# electron-hello-world change log
# Friends change log

All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
Expand Down
57 changes: 57 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,57 @@
# Contributing Guidelines

Contributions welcome!

Please search issues and pull requests before adding something new to avoid duplicating efforts and conversations.

In addition to improving the project by refactoring code and and implementing relevant features, this project welcomes the following types of contributions:

- **Ideas**: participate in an issue thread or start your own to have your voice heard.
- **Writing**: contribute your expertise in an area by helping expand the included content.
- **Copy editing**: fix typos, clarify language, and generally improve the quality of the content.
- **Formatting**: help keep content easy to read with consistent formatting.

## Installing

Fork and clone the repo, then `npm install` to install all dependencies.

## Testing

Tests are run with `npm test`. Please ensure all tests are passing before submitting a pull request (unless you're creating a failing test to increase test coverage or show a problem).

## Code Style

[![standard][standard-image]][standard-url]

This repository uses [`standard`][standard-url] to maintain code style and consistency, and to avoid style arguments. `npm test` runs `standard` so you don't have to!

[standard-image]: https://cdn.rawgit.com/feross/standard/master/badge.svg
[standard-url]: https://github.com/feross/standard

---

# Collaborating Guidelines

**This is an OPEN Open Source Project.**

## What?

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

## Rules

There are a few basic ground-rules for contributors:

1. **No `--force` pushes** or modifying the Git history in any way.
1. **Non-master branches** ought to be used for ongoing work.
1. **External API changes and significant modifications** ought to be subject to an **internal pull-request** to solicit feedback from other contributors.
1. Internal pull-requests to solicit feedback are *encouraged* for any other non-trivial contribution but left to the discretion of the contributor.
1. Contributors should attempt to adhere to the prevailing code style.

## Releases

Declaring formal releases remains the prerogative of the project maintainer.

## Changes to this arrangement

This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change.
5 changes: 5 additions & 0 deletions README.md
@@ -1,5 +1,10 @@
# Friends

[![travis][travis-image]][travis-url]

[travis-image]: https://img.shields.io/travis/feross/friends.svg?style=flat
[travis-url]: https://travis-ci.org/feross/friends

## Building

* `npm install`
Expand Down
16 changes: 7 additions & 9 deletions app.js
@@ -1,5 +1,3 @@
var inherits = require('inherits')
var xtend = require('xtend')
var h = require('virtual-dom/h')
var diff = require('virtual-dom/diff')
var patch = require('virtual-dom/patch')
Expand All @@ -9,7 +7,7 @@ var raf = require('raf')
var Channels = require('./elements/channels')
var Messages = require('./elements/messages')

function App(el) {
function App (el) {
if (!(this instanceof App)) return new App(el)
var self = this

Expand All @@ -22,18 +20,18 @@ function App(el) {
{ id: 3, name: 'feross' },
{ id: 4, name: 'nate' },
{ id: 5, name: 'chris' },
{ id: 6, name: 'kyle' },
{ id: 6, name: 'kyle' }
],
messages: [
{ user_id: 0, message: 'this is a message' },
{ user_id: 0, message: 'this is another message' },
{ user_id: 0, message: 'this is another message' }
]
}

// View instances used in our App
this.views = {
channels: new Channels(),
messages: new Messages(),
messages: new Messages()
}

// Initial DOM tree render
Expand All @@ -42,7 +40,7 @@ function App(el) {
el.appendChild(rootNode)

// Main render loop
raf(function tick() {
raf(function tick () {
var newTree = self.render()
var patches = diff(tree, newTree)
rootNode = patch(rootNode, patches)
Expand All @@ -52,7 +50,7 @@ function App(el) {
}
window.App = module.exports = App

App.prototype.render = function() {
App.prototype.render = function () {
var views = this.views
var data = this.data
return h('div', {
Expand All @@ -63,6 +61,6 @@ App.prototype.render = function() {
}, views.channels.render(data.channels)),
h('div', {
className: 'content'
}, views.messages.render(data.messages)),
}, views.messages.render(data.messages))
])
}
11 changes: 5 additions & 6 deletions elements/channels.js
@@ -1,18 +1,17 @@
var inherits = require('inherits')
var h = require('virtual-dom/h')

function Channels(params) {
function Channels (params) {
if (!(this instanceof Channels)) return new Channels(params)
this.className = 'channels'
}
module.exports = Channels

Channels.prototype.render = function(channels) {
channels = channels.map(function(channel) {
Channels.prototype.render = function (channels) {
channels = channels.map(function (channel) {
return h('li', [
h('button', {
onclick: function() {
alert('select channel! ' + channel.id)
onclick: function () {
window.alert('select channel! ' + channel.id) // eslint-disable-line
}
}, [channel.name])
])
Expand Down
7 changes: 3 additions & 4 deletions elements/messages.js
@@ -1,14 +1,13 @@
var inherits = require('inherits')
var h = require('virtual-dom/h')

function Messages(params) {
function Messages (params) {
if (!(this instanceof Messages)) return new Messages(params)
this.className = 'messages'
}
module.exports = Messages

Messages.prototype.render = function(messages) {
messages = messages.map(function(msg) {
Messages.prototype.render = function (messages) {
messages = messages.map(function (msg) {
return h('li', [msg.user_id + ': ' + msg.message])
})
return h('ul', this, messages)
Expand Down

0 comments on commit ec2d910

Please sign in to comment.