Skip to content

Commit

Permalink
Update example to demonstrate AMD
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
Oliver Joseph Ash committed Mar 12, 2014
1 parent 02944ed commit e71416a
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,21 @@ bower install scribe
<dd>Enable/disable block element mode (enabled by default)</dd>
</dl>

## Example
## Usage Example

Scribe is an AMD module:

``` js
var scribeElement = document.querySelector('.scribe');
// Create an instance of Scribe
var scribe = new Scribe(scribeElement);

// Use some plugins
scribe.use(scribePluginBlockquoteCommand());
var toolbarElement = document.querySelector('.toolbar');
scribe.use(scribePluginToolbar(toolbarElement));
require(['scribe'], function () {
var scribeElement = document.querySelector('.scribe');
// Create an instance of Scribe
var scribe = new Scribe(scribeElement);

// Use some plugins
scribe.use(scribePluginBlockquoteCommand());
var toolbarElement = document.querySelector('.toolbar');
scribe.use(scribePluginToolbar(toolbarElement));
});
```

You can [see a live example here][example], or [view the code here](https://github.com/guardian/scribe/tree/gh-pages).
Expand Down

0 comments on commit e71416a

Please sign in to comment.