Git Product home page Git Product logo

hashdo's Introduction

#Do

#Do is framework for creating static or stateful interaction based cards that can be embedded in mobile applications or viewed in a browser. This is the base library that can be used in your own projects to generate, embed or serve #Do cards.

If you are looking for a way to create cards, get your hands on the #Do CLI which contains templates to quickly generate packs and cards as well as a test harness to easily test your card functionality.

Card examples can be found here: https://github.com/UXFoundry/hashdo-cards

Getting Started

Step 1

Install #Do into your project using NPM.

npm install hashdo --save

Step 2

Require it in your code.

var hashdo = require('hashdo');

Step 3

Generate the HTML, CSS and script necessary to render your card.

hashdo.card.generateCard({
  url: 'http://hashdo.com/restaurants/nearby',
  directory: '/Where/Your/Cards/Are/Located',
  packName: 'restaurants',
  cardName: 'nearby',
  inputValues: {
    latitude: -29.837795,
    longitude: 30.922539
  }
},
// Callback containing an error or the HTML you can render.
function (err, html) {
  if (!err) {
    // Do something with the HTML.
    console.log(html);
  }
  else {
    console.error(err);    
  }
});

Check out our open source #Do cards to test things out with or use the #Do CLI to create your own.

API

Packs

The packs module is accessible through hashdo.packs. This modules contains information about the packs and cards available.

Cards

The card module is accessible through hashdo.card. This module is used to secure inputs, generated card HTML and also perform the logic necessary for a web hook call.

Environment Variables

CARD_SECRET

Provide a value for this if you want to properly secure the URL and query parameters of a card.

LOCK_KEY

Provide a value for this if you want to properly secure input data in the database when using 'secureInputs'.

BASE_URL

Required if making use of client state. This will be the URL that cards will make HTTP calls to.

FIREBASE_URL

Use Firebase to update card state on the client when it changes. Without this the card will need to be refreshed manually to update it's client data.

Plugins

Modules can be replaced by your own implementations if necessary. Good examples of this are the data store or the analytics provider you wish to use.

The following plugins are available. If you have created your own plugins, let us know and we'll add links here.

Database

By default #Do uses an in-memory database. Card states and locks are lost when the application unloads but this is actually great for development and testing purposes.

MongoDB Plugin - Use this database plugin to persist your data to a MongoDB database.

Analytics

By default #Do has no analytics implementation. When an event is triggered it will output the details to the console.

Keen IO Analytics Plugin - Use this analytics plugin to send events to Keen IO.

To use a plugin, simply replace the exposed property with a new implementation. Each plugin's documentation will describe the requirements and the process of replacing the functionality.

View Engine Support

Currently #Do supports the following view engines.

Any view engine that Consolidate supports can be added as well if necessary. Using a view engine is not a requirement, you are welcome to use regular HTML.

CSS Preprocessor Support

Currently #Do supports the following CSS preprocessors.

Using a preprocessor is not a requirement, you are welcome to use regular CSS.

License

Copyright 2015 (c). All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

hashdo's People

Contributors

shauntrennery avatar brutaldev avatar mmcev106 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.