From 271eaf04e298cce4f4066f2303c059976383dc66 Mon Sep 17 00:00:00 2001 From: Roger Rodriguez Date: Thu, 9 Jun 2016 20:17:43 -0400 Subject: [PATCH] adding readme --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2b7fe12 --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +# Backpack + +Backpack is for building custom apps for use with Movable Ink + +## Installation + +Backpack is on bower. Install it with: + +```bash +npm install -g bower # if bower is not installed yet +bower init +bower install --save mi-backpack +``` + +Then use it by referencing it from your HTML page: + +```html + +``` + +And from your JS: + +```javascript +var myApp = new Backpack(); +``` + +## API + +### Trigger the fallback image + +`.forceFallback()` is useful for triggering the static fallback image associated with the block. Note: by default it will remove the `#mi_size_container` element from the DOM. + +Example: + +```javascript +myApp.forceFallback() +``` + + +### Logging to console + +`.logger()` makes it easier to follow `console.logs()` inside the app debug console. + +Example: + +```javascript +myApp.logger('hello world') +``` + + +### Trigger an event + +`.trigger()` creates a synthetic event that bubbles up to the `document`. + +Example: + +```javascript +myApp.trigger('error', 'some helpful error comment'); +``` + + +### Listen for an event + +`.on()` attaches an event handler. Note: Any information associated with the event will be in the `detail` property of the response. + +Example: + +```javascript +myApp.on('error', function(msg){ + // msg.detail -- 'some helpful error comment' +}); +```