Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/traitify/traitify-js


https://github.com/traitify/traitify-js

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# THIS LIBRARY HAS BEEN DEPRECATED, PLEASE USE https://github.com/traitify/traitify-widgets

Traitify.js
===============

This package does not require jQuery, as it is a standalone encapsulated library. It does however require a browser with the ability to make cors requests (currently only supports ie10 and up, chrome, safari, and firefox).

### Assessment id and public key required!
For instructions on obtaining an assessment id and a public key visit:
[https://developer.traitify.com](https://developer.traitify.com)

### Using The Latest and Greatest(Edge)!
For directions on using the latest traitify js scroll to the bottom

### Using Traitify JS UI:
Include the Traitify.js library:

```xhtml

```

You can initialize using an id or a class on any div tag:
```HTML


```

The following javascript will initialize with the above html:
```HTML

Traitify.setPublicKey("8asdf8sda-f98as-df8ads-fadsf"); // Example Public Key
Traitify.setHost("api-sandbox.traitify.com"); // Example host url (Defaults to api.traitify.com)
Traitify.setVersion("v1"); // Example Version
var assessmentId = "34aeraw23-3a43a32-234a34as42"; // Example Assessment id

traitify = Traitify.ui.load(assessmentId, ".traitify-widget"); // Example selector for widget target

```

When you initialize the widget we return our widget builder to you (This is the same builder we use to construct the widget).
```HTML

traitify = Traitify.ui.load(assessmentId, ".traitify-widget")

// This callback gives you the ability to trigger an event when
// the widget has finished loading
traitify.onInitialize(function(){
console.log(traitify.data);
console.log("Initialized");
})

// This callback gives you the ability to trigger an event when
// the user has finished playing the slide deck
traitify.onFinished(function(){
console.log(traitify.data);
console.log("Finished!");
})

```
===============
### Using Traitify JS API CLIENT:
```xhtml

```

##### Get Decks
```JavaScript
Traitify.getDecks("assessment id", function(data){
console.log(data)
})
```

##### Get Slides
```JavaScript
Traitify.getSlides("assessment id", function(data){
console.log(data)
})
```

##### Get Personality Traits
```JavaScript
Traitify.addSlide("assessment id", function(data){
console.log(data)
})
```

##### Get Personality Traits
```JavaScript
Traitify.getPersonalityTraits("assessment id", function(data){
console.log(data)
})
```

##### Get Careers
```JavaScript
Traitify.getCareers("assessment id", function(data){
console.log(data)
})
```
### Using Edge
Warning, things may break if you use edge, it is not stable, and is not intended to be. If you're looking for a stable deployment then use the v1 bundle from the above cdn.
```xhtml

Traitify.setPublicKey("8asdf8sda-f98as-df8ads-fadsf"); // Example Public Key
Traitify.setHost("api-sandbox.traitify.com"); // Example host url (Defaults to api.traitify.com)
Traitify.setVersion("v1"); // Example Version
var assessmentId = "34aeraw23-3a43a32-234a34as42"; // Example Assessment id

traitify = Traitify.ui.load(assessmentId, ".traitify-widget"); // Example selector for widget target

```

### Contributing
#### Building, Testing and Bundling:
```Shell
$ cake watch
$ cake build
$ cake bundle
$ cake test
```