Skip to content

Commit

Permalink
add docs, css tweak, add test instance demo
Browse files Browse the repository at this point in the history
  • Loading branch information
0x8890 committed Sep 14, 2016
1 parent ae4d89c commit cd8aae4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ var message = require('./common/message')
* functions.
* - `methods`: a hash that maps to string constants. Available are: `find`,
* `create`, `update`, and `delete`.
* - `events`: names for events on the Fortune instance.
* - `events`: names for events on the Fortune instance. Available are:
* `change`, `sync`, `connect`, `disconnect`, `failure`.
* - `message`: a function which accepts the arguments (`id`, `language`,
* `data`). It has properties keyed by two-letter language codes, which by
* default includes only `en`.
Expand Down
6 changes: 3 additions & 3 deletions lib/net/page.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

/* page */
html, body { height: 100% }
body, input { font-size: 16px; font-family: 'Avenir', 'Calibri', 'FreeSans', sans-serif; }
body, input { font-size: 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; }
body { line-height: 1.5; background: #eee; color: #444; }
a { color: inherit; text-decoration: inherit; }
h1, h2, h3, h4, h5, h6, aside > label { font-family: 'Garamond', 'Times New Roman', Times, serif; }
h1, h2, h3, h4, h5, h6 { font-size: 1.25em; line-height: 1.2; font-weight: normal; font-style: italic; }

/* index */
.index header { padding: 3em 0; background: #fff; border-bottom: 1px #ccc solid; margin-bottom: 3em; }
.index header > div { max-width: 46em; margin: 0 auto; padding: 0 1.5em; }
.index header > div, .property-header, .property-list { max-width: 52em; margin: 0 auto; padding: 0 1.5em; }
.index header > div > h1:first-of-type { font-family: inherit; font-style: inherit; font-weight: bold; font-size: 2em; margin-bottom: 0.75em; line-height: inherit; }
.index .description { font-weight: normal; margin: 3em 0 1.5em; }
.index .description > * { margin-bottom: 1.5em; }
Expand All @@ -25,7 +25,7 @@ h1, h2, h3, h4, h5, h6 { font-size: 1.25em; line-height: 1.2; font-weight: norma
.types-list .comment { display: none; }

/* property list */
.property-header, .property-list { max-width: 46em; margin: 1.5em auto; padding: 0 1.5em; }
.property-header, .property-list { margin: 1.5em auto; }
.property-list { margin-bottom: 4.5em; }

/* definitions */
Expand Down
26 changes: 26 additions & 0 deletions test/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict'

const http = require('http')
const util = require('util')
const chalk = require('chalk')
const instance = require('./integration/test_instance')
const fortune = require('../lib')

const port = 1337

instance().then(store => {
store.options.settings.name = 'Foobar'
store.options.settings.description = `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse eleifend tempor vulputate. Etiam rhoncus vulputate leo nec accumsan. Etiam eleifend ultrices faucibus. Vestibulum quis sem neque.`
store.options.documentation = {
user: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
name: {
en: 'Vestibulum vitae velit id tellus vehicula dictum nec at ante. Sed pulvinar eros quis volutpat volutpat. Integer a pulvinar tellus, ut vehicula diam.'
}
}

store.on(fortune.events.change, data => console.log(chalk.cyan(
`${chalk.bold('Change')}: ${util.inspect(data, { depth: null })}`)))

const server = http.createServer(fortune.net.http(store))
server.listen(port, () => console.log(chalk.blue(`Listening on port ${port}...`)))
})

0 comments on commit cd8aae4

Please sign in to comment.