Permalink
Browse files

updated readme and package.json

  • Loading branch information...
1 parent 1fa9404 commit 552bcc5a4abdcf0b019f5e81888841a5ade659ed @gushov committed Nov 21, 2012
Showing with 86 additions and 9 deletions.
  1. +85 −8 README.md
  2. +1 −1 package.json
View
@@ -2,20 +2,97 @@
A li'l backbone-ish model object.
-## Getting Started
-Install the module with: `npm install lilmodel`
+## Browser usage
+
+load dist/lilobj.js or dist/lilobj.min.js in you browser and call it like this:
```javascript
-var model = require('lilmodel');
+(function () {
+
+ var model = require('lilmodel').model;
+
+ var beer = model.extend({
+
+ defaults: {
+ sizeInLiters: 0.5,
+ },
+
+ rules: {
+ type: ['required', 'string']
+ sizeInLiters: ['required', 'number', ['gte', 0.2]]
+ }
+
+ });
+
+ var dunkel = beer.create({
+ type: 'lager',
+ });
+
+ dunkel.save(function (err) {
+ //callback from sync
+ });
+
+}());
+```
+
+## Node usage
+
+install the module with: `npm install lilmodel`
+
+```javascript
+var beer = model.extend({
+
+ defaults: {
+ sizeInLiters: 0.5,
+ },
+
+ rules: {
+ type: ['required', 'string']
+ sizeInLiters: ['required', 'number', ['gte', 0.2]]
+ }
+
+});
+
+var dunkel = beer.create({
+ type: 'lager',
+});
+
+dunkel.save(function (err) {
+ //callback from sync
+});
```
+
## Documentation
-_(Coming soon)_
-## Examples
-_(Coming soon)_
+### syncr(sync)
+
+__sync(method, obj, callback)__
+
+__methods__
+
+* 'create'
+* 'update'
+* 'fetch'
+* 'destroy'
+* 'find'
+
+### model.extend(config)
+
+__config__
+
+* defaults
+* rules
+* children
+
+### model.create(properties)
+
+### _modelInstance_.validate()
+
+### _modelInstance_.save(callback)
+
+### _modelInstance_.fetch(callback)
-## Release History
-_(Nothing yet)_
+### _modelInstance_.destroy(callback)
## License
Copyright (c) 2012 August Hovland
View
@@ -2,7 +2,7 @@
"author": "August Hovland <gushov@gmail.com>",
"name": "lilmodel",
"description": "A li'l model wrapper",
- "version": "0.0.0",
+ "version": "0.0.1",
"repository": {
"type": "git",
"url": "git://github.com/gushov/lilmodel.git"

0 comments on commit 552bcc5

Please sign in to comment.