GithubHelp home page GithubHelp logo

be.js's Introduction

Behance API JS Wrapper

A relatively simple JavaScript wrapper to get data from the Behance API

Usage

Get be.js on your page through a module loader like RequireJS, or include it directly with a <script> tag. be.js is AMD-compatible, and will anonymously export a module. If you are using a raw <script> tag, then it will export the be global.

Once you have access to the export, using it is easy.

  1. Set your Behance API key. You can set the key by either calling the export as a function or by setting a global called behance_api_key before including be.js

    require(['be'], function(be) {
     be('BehanceApiKey');
    });
  2. Make the API request. The be export has various functions attached to it in order to make the API requests for the publicly available endpoints in the Behance API. Every request function returns a Promises/A+ compliant promise. They also take a callback.

 require(['be'], function(be) {
   // Using promises
   be('BehanceApiKey')
   .project.search('cats')
   .then(function success(results) {
     console.log(results);
   }, function failure(error) {
     console.error(error);
   });
 
   // Using callbacks
   be.project.search('dogs', function success(results) {
     console.log(results);
   });
 });

Notes

be.js makes use of alternate providers of JSONP implementations when available. If RequireJS is available, it will use require() to perform every JSONP call. If JQuery is available, it will use jQuery.ajax() with a timeout of 7000ms. If in a WebWorker context, it will use importScripts().

If none of the above are available, it will use its native JSONP implementation using <script> tag injection.

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.