madrobby/microjs.com — pull request #614 by daniellmb (2014-07-07 15:47:29+00:00)
Title: Add once.js

# once.js
[![Build Status][build-image]][build-url] [![Code GPA][gpa-image]][gpa-url] [![Test Coverage][coverage-image]][coverage-url] [![Dependency Status][depstat-image]][depstat-url] [![Bower Version][bower-image]][bower-url]
[![NPM version][npm-image]][npm-url] [![IRC Channel][irc-image]][irc-url] [![Gitter][gitter-image]][gitter-url]

## About

Once.js is a 0.1kb micro-library that enables you to enforce a function can only be executed once. Once.js completely dependency-free and written in both CoffeeScript and JavaScript for AMD, Node.js and the Web.

## Examples

### JavaScript

```JavaScript
var canOnlyRunOnce = once(function() {
console.log('That Happened!');
});
canOnlyRunOnce(); // 'That Happened!'
canOnlyRunOnce(); // *cricket cricket*
```

### CoffeeScript

```CoffeeScript
canOnlyRunOnce = once(->
console.log 'That Happened!'
)
canOnlyRunOnce() # 'That Happened!'
canOnlyRunOnce() # *cricket cricket*
```

[build-url]: https://travis-ci.org/daniellmb/once.js
[build-image]: http://img.shields.io/travis/daniellmb/once.js.png

[gpa-url]: https://codeclimate.com/github/daniellmb/once.js
[gpa-image]: https://codeclimate.com/github/daniellmb/once.js.png

[coverage-url]: https://codeclimate.com/github/daniellmb/once.js/code?sort=covered_percent&sort_direction=desc
[coverage-image]: https://codeclimate.com/github/daniellmb/once.js/coverage.png

[depstat-url]: https://david-dm.org/daniellmb/once.js
[depstat-image]: https://david-dm.org/daniellmb/once.js/dev-status.png?theme=shields.io

[issues-url]: https://github.com/daniellmb/once.js/issues
[issues-image]: http://img.shields.io/github/issues/daniellmb/once.js.png

[bower-url]: http://bower.io/search/?q=once.js
[bower-image]: https://badge.fury.io/bo/once.js.png

[downloads-url]: https://www.npmjs.org/package/once.js
[downloads-image]: http://img.shields.io/npm/dm/once.js.png

[npm-url]: https://www.npmjs.org/package/once.js
[npm-image]: https://badge.fury.io/js/once.js.png

[irc-url]: http://webchat.freenode.net/?channels=once.js
[irc-image]: http://img.shields.io/badge/irc-%23once.js-brightgreen.png

[gitter-url]: https://gitter.im/daniellmb/once.js
[gitter-image]: http://img.shields.io/badge/gitter-daniellmb/once.js-brightgreen.png