Classes
Methods
(static) composeApiString(api, params) → {String}
A function to compose query string
Parameters:
Name | Type | Description |
---|---|---|
api |
Strinq | |
params |
Object | a key value object: will be append to |
Returns:
the string composed
- Type
- String
Example
var API = "http://jsonplaceholder.typicode.com/comments"
var url = composeApiString(API, {postId:1});
// url will be "http://jsonplaceholder.typicode.com/comments?postId=1"
(static) getImageRaw(options, _onProgressopt) → {Promise.<(Blob|ArrayBuffer|Error)>}
getImageRaw from a specific url
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | the options object
Properties
|
|||||||||||||||||||||||||||
_onProgress |
function |
<optional> |
function(){} |
Returns:
- Type
- Promise.<(Blob|ArrayBuffer|Error)>
(static) getJSON(url) → {Promise.<(Object|String)>}
getJSON
Parameters:
Name | Type | Description |
---|---|---|
url |
String | for example http://jsonplaceholder.typicode.com/comments?postId=1 |
Returns:
the string error is the statuscode
- Type
- Promise.<(Object|String)>
(static) Iterator(array) → {Object}
Iterator
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | the array you want to transform in iterator |
Returns:
- an iterator-like object
- Type
- Object
Example
var myArray = ["pippo", "pluto", "paperino"];
var it = Utils.Iterator(myArray);
it.next().value === "pippo"; //true
it.next().value === "pluto"; //true
it.next(true).value === "paperino" //false because with true you can reset it!