Skip to content

Latest commit

 

History

History
253 lines (236 loc) · 6.99 KB

modules.md

File metadata and controls

253 lines (236 loc) · 6.99 KB
title layout
HelloJs Modules
default

HelloJS Modules

HelloJS is extensible, i.e. you can add new services to it as long as you can get your head around the important parts.

A module defines a providers Authorisation and RESTful endpoints. It translates the API's nuances for the provider to closely match those of its peers with similar features.

HelloJS already has you connected

The table shows the services which are already documented on HelloJS. Simply include these scripts in your page after your HelloJS script tag.

module demo credits
box.js Box.com demo
bikeindex.js Bike Index demo
dropbox.js Dropbox demo
facebook.js
foursquare.js Foursquare demo
flickr.js Flickr demo
github.js GitHub demo
google.js Google+ demo
instagram.js Instagram demo
joinme.js join.me demo
linkedin.js LinkedIn demo
soundcloud.js SoundCloud demo
tumblr.js Tumblr demo
twitter.js Twitter demo
vk.js
windows.js
yahoo.js Yahoo demo

Writing your own module

Modules are loaded into HelloJS using the hello.init() method, with a JSON object that has the name of the service as the only key and then whose value consists of an object with the following properties.

name type example description argument default
oauth Object
nametypedescription
version string Version of OAuth, 1.0, 1.0a, 2
request url Path of the first leg of OAuth 1
auth url Path of the authorization URL, second leg of OAuth 1
token url Path to get the Access token, OAuth 1 only, third leg of flow
grant url Path to get the Access token, OAuth2 only
response_type string Implicit (token) or Explicit (code) Grant flow
required
login function A function to augment the login request. optional
refresh Boolean Indicate that the providers supports silent signin, aka display=none, however if a refresh_token was proffered at signin, then an attempt will be made with that. optional false
scope Object A dictionary of key and value (the providers sudonym or name of comparative scope) optional
scope_delim string ,, Overrides the default delmiter between multiple scopes optional ,
base url Prefix for all API requests required
get,post,put,del Object Map of standardized pathnames to an alternative path, or path rendering function, the key 'default' will be used where the path is unrecognised, see examples optional
wrap Object Map containing response processing handlers, the key 'default' will be used where the path is unrecognised. optional
xhr, jsonp, form function A function called if the browser supports the method requests. Use this function to augment the request. Return truthy value to proceed or false to fallback to another method. optional true

Contributing modules

That would be fantastic if you could. Please make the following updates so its easiy for people to discover and test.

  • Fork the code from GitHub
  • Name your script with the label you want it to be identified with and use this as the key name of module settings above
  • Add your module to tests/hello.all.js
  • Check your script passes the test in as many browsers as you can.
  • Update the list of services above with a name and link, also get credit for your hard work by including your name