Skip to content

Commit

Permalink
Edit README.md, add CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanqing committed May 31, 2015
1 parent 5e462f4 commit e4ef055
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 24 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog

## 1.3.0
- Drop Browserify/Segue dependency (trims almost 1 KB off the minified weight)

## 1.2.0
- Add `opts.getter` and `opts.setter` to allow the effect to be applied on other element properties

## 1.1.1
- Use [Segue](https://github.com/yuanqing/segue) v0.2.0

## 1.1.0
- Restore ability to `delete` by number of characters

## 1.0.0
- Add `opts.typeSpeed` and `opts.deleteSpeed` in place of `opts.speed`
- Rename `opts.delay` to `opts.pauseDelay`
- Remove `delete(n)`

## 0.0.1
- Initial release
40 changes: 16 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
> Simulate a typewriter/ticker effect on a DOM element.
- [Friendly, flexible API](#api)
- Super lightweight; 2.3 KB [minified](https://github.com/yuanqing/malarkey/blob/master/dist/malarkey.min.js), or 1.1 KB minified and gzipped
- No dependencies
- Super lightweight; just 1.25 KB [minified](dist/malarkey.min.js), or 0.7 KB minified and gzipped

For an in-production demo, see [the npm website](https://npmjs.com) and [the relevant source code](https://github.com/npm/newww/blob/master/assets/scripts/what-npm-is-for.js).

## Usage

> [**Editable demo**](http://jsfiddle.net/yoyjoLhx/)
> [**Demo**](http://jsfiddle.net/yoyjoLhx/)
```html
<body>
Expand All @@ -28,9 +31,9 @@
</body>
```

By default, the effect is applied on `elem.innerHTML`. To apply it on other element properties (such as the `placeholder` attribute of an `input` element), pass in `opts.getter` and `opts.setter`, like so:
By default, the effect is applied on `elem.innerHTML`. To **apply the effect on other element properties** (such as the `placeholder` attribute of an `input` element), pass in `opts.getter` and `opts.setter`, like so:

> [**Editable demo**](http://jsfiddle.net/qu88jvb9/)
> [**Demo**](http://jsfiddle.net/qu88jvb9/)
```html
<body>
Expand All @@ -56,6 +59,10 @@ By default, the effect is applied on `elem.innerHTML`. To apply it on other elem

## API

In the browser, `malarkey` is attached on the `window` object. (As seen in our examples above.)

In Node, do:

```js
var malarkey = require('malarkey');
```
Expand All @@ -71,7 +78,7 @@ Initialises the typewriter/ticker effect on `elem` with the given `opts` setting
- `typeSpeed` &mdash; Time in milliseconds to `type` a single character. Defaults to `50`.
- `deleteSpeed` &mdash; Time in milliseconds to `delete` a single character. Defaults to `50`.
- `pauseDelay` &mdash; Delay in milliseconds to `pause`. Defaults to `2000`.
- `postfix` &mdash; A string that is appended to the `str` that is passed to `type` and `delete`. Defaults to the empty string.
- `postfix` &mdash; A string that is appended to the `str` that is passed to `type` and `delete`. Defaults to `''`.
- `getter` &mdash; A function to get the current value of `elem`. Defaults to `function(elem) { return elem.innerHTML; }`.
- `setter` &mdash; A function to assign a new value to `elem`. Defaults to `function(elem, val) { elem.innerHTML = val; }`.

Expand Down Expand Up @@ -107,7 +114,7 @@ Clear the contents of `elem`.

Do nothing for `delay`.

- `delay` &mdash; Defaults to `opts.pauseDelay`.
- `delay` &mdash; Default: `opts.pauseDelay`.

### m.call(fn)

Expand All @@ -119,31 +126,16 @@ Call the given asynchronous `fn`, passing it `elem` as the first argument.

Install via [npm](https://npmjs.com):

```bash
```
$ npm i --save malarkey
```

Install via [bower](http://bower.io):

```bash
```
$ bower i --save yuanqing/malarkey
```

## Changelog

- 1.2.0
- Add `opts.getter` and `opts.setter` to allow the effect to be applied on other element properties
- 1.1.1
- Use [Segue](https://github.com/yuanqing/segue) v0.2.0
- 1.1.0
- Restore ability to `delete` by number of characters
- 1.0.0
- Add `opts.typeSpeed` and `opts.deleteSpeed` in place of `opts.speed`
- Rename `opts.delay` to `opts.pauseDelay`
- Remove `delete(n)`
- 0.0.1
- Initial release

## License

[MIT](https://github.com/yuanqing/malarkey/blob/master/LICENSE)
[MIT](LICENSE)

0 comments on commit e4ef055

Please sign in to comment.