firenze-behavior-timestamp
Timestamp behavior for firenze.js.
Automatically generate timestamps on certain fields, when saving records.
$ npm install --save firenze-behavior-timestamp
$ bower install --save firenze-behavior-timestamp
Contents
What it does
When saving a new model, it will automatically populate timestamp as value on speficied field(s).
For example, when saving a post:
var posts = ;var post = posts; post;
It will automatically save the value of current timestamp in created
field.
Usage
Node.js
With npm:
$ npm install --save firenze-behavior-timestamp
Now you can require it as follows:
var TimestampBehavior = ; // create your Database instance... db;
Browser
Or Bower:
$ bower installl --save firenze-behavior-timestamp
Can be loaded in your HTML page as follows:
<script src="bower_components/firenze/dist/firenze.full.min.js"></script><script src="bower_components/moment/min/moment.min.js"></script><script src="bower_components/firenze-behavior-timestamp/dist/firenze-behavior-timestamp.min.js"></script> <script> // Timestamp behavior is available in `firenze.TimestampBehavior`</script>
Testing
Tests are written with mocha, and can be run via npm:
$ npm test
License
MIT © Fahad Ibnay Heylaal