Skip to content

Commit

Permalink
Merge pull request #3 from blocks/publish-first-release
Browse files Browse the repository at this point in the history
update readme and fix dependency problems
  • Loading branch information
localjo committed Nov 11, 2014
2 parents 3c85005 + f092ece commit 2da8deb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ Using npm;
- `npm install blocks-alerter`

Using Bower;
- [Install using the tarball URL][http://bower.io/docs/api/#install] (best option)
- Use browserify or webpack to consume the CommonJS module
- Install dependencies and run `gulp build` after installing/updating with Bower
- [Install using the tarball URL](http://bower.io/docs/api/#install) (best option)
- Or use browserify or webpack to consume the CommonJS module

**Note:** *If you're including this module via Browserify, you need to apply the `hbsfy` transform globally.*

# Quick Start
To get started, you'll need to include the script on your page. To create an `Alerter()` instance you can do;
Expand All @@ -26,7 +27,7 @@ var myAlerter = new Alerter();
You can then create an alert like this;

```
var myAlert = myAlerter.create(message);
var myAlert = myAlerter.create({message: 'Hello!'});
```

And dismiss the alert like this;
Expand All @@ -48,8 +49,8 @@ Out of the box, the module will generate BEM markup with the namespace `alert` t

## Methods

### `Alerter.create(message, type)`
Creates a new alert DOM object and injects it into the page via the `Alerter()` object.
### `Alerter.create(optionsHash)`
Creates a new alert DOM object and injects it into the page via the `Alerter()` object. You can pass the following options in;
- `message` **(Required)** this is a string with the message you want to display. You can use plain text or an HTML string with inline tags.
- `detail` This is a string with more details related to the main message.
- `errors` This is an array of strings. It will be displayed as a `<ul>` in the default template, and can be useful for listing specific items that need to be addressed by the user.
Expand All @@ -69,4 +70,4 @@ Fires whenever an alert is created. Contains a payload object with the alert mes
Fires whenever an alert message is dismissed. Contains a payload object with the unique id of the alert that was dismissed.

# Testing the Module
If you want to build and test this module yourself, you can do so by running `gulp` to build the module and start a server or `gulp test` to build the module, start a server, open a tunnel to BrowserStack and run mocha tests. Before you can run mocha tests, you'll have to define a BrowserStack key and username in `/test/selenium-driver.js` and BrowserStack key in `/gulp/startBrowserStackTunnel.js`.
If you want to build and test this module yourself, you can do so by running `gulp` to build the module and start a server or `gulp test` to build the module, start a server, open a tunnel to BrowserStack and run mocha tests. Before you can run mocha tests, you'll have to define a BrowserStack key and username in `/test/selenium-driver.js` and BrowserStack key in `/gulp/startBrowserStackTunnel.js`.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blocks-alerter",
"version": "1.0.0",
"version": "1.0.1",
"description": "Injects notification and alert markup and UI in the browser.",
"main": "src/alerter.js",
"files": [
Expand Down Expand Up @@ -37,7 +37,6 @@
"gulp-util": "^3.0.1",
"handlebars": "1.3.x",
"hbsfy": "^2.1.0",
"inherits": "^2.0.1",
"jquery": "^2.1.1",
"mocha": "^1.21.5",
"mocha-clean": "^0.3.0",
Expand All @@ -46,5 +45,9 @@
"require-dir": "^0.1.0",
"run-sequence": "~0.3.7",
"vinyl-source-stream": "^0.1.1"
},
"dependencies": {
"events": "^1.0.2",
"inherits": "^2.0.1"
}
}

0 comments on commit 2da8deb

Please sign in to comment.