1.7.10 • Published 2 years ago

@widgetic/sdk v1.7.10

Weekly downloads
-
License
UNLICENSED
Repository
gitlab
Last release
2 years ago

Client Library for the Widgetic API

This is a JavaScript client library for the Widgetic API, written in CoffeeScript, suitable for use in most browsers.

##Installation

In the browser

This library is available at https://widgetic.com/sdk/sdk.js so add the following script tag in the head section of your page:

<script type="text/javascript" src="https://widgetic.com/sdk/sdk.js"></script>

Usage

The documentation is available on the Widgetic Documentation website.

The library exposes a global Widgetic variable that you can use to interact with the SDK's functions.

The first step is to initialize the SDK with your Widgetic app_id and redirect_url:

Widgetic.init('<app_id here>', '<redirect_url here>');

After this step you can login using the Widgetic.auth() function.

You can pass a Boolean parameter that indicates if a popup should be opened or you just want to check if user is logged in. Default will open popup.

This has promise support built-in using the aye library.

//Check if user is logged in
Widgetic.auth(false).then(
  function() {
    /*handle success*/
  },
  function() {
    /*handle fail*/
  }
);
//Open popup to login user
Widgetic.auth().then(
  function() {
    /*handle success*/
  },
  function() {
    /*handle fail*/
  }
);

After user is logged in you call the Widgetic API using Widgetic.api(url, method, data). This function returns a promise. For example if you want to grab user info:

Widgetic.api('users/me').then(
  function(data) {
    /*handle success*/
  },
  function(error) {
    /*handle fail*/
  }
);
1.7.10

2 years ago

1.7.9

3 years ago

1.7.8

3 years ago

1.7.7

3 years ago

1.7.6

3 years ago

1.7.5

3 years ago

1.7.4

4 years ago

1.7.2

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.6.4-esdev

4 years ago

1.6.4-ecmascript

4 years ago

0.0.0-esdev

4 years ago

1.6.4

4 years ago

1.5.0

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

0.6.1-weebly.5

6 years ago

1.1.1

6 years ago

0.6.1-weebly.4

7 years ago

0.6.1-weebly.3

7 years ago

0.6.1-weebly.2

7 years ago

1.0.0

7 years ago

0.7.2

7 years ago

0.6.1-weebly.1

7 years ago

0.7.0

7 years ago

0.6.4

7 years ago