This is a list of the parameters and methods available in the GoodBarber JavaScript ToolKit.


1

Var : int gbDebuggingMode

Sets the debugging mode using a system of code values. 

Values :
- 0 : Production mode
- 1 : Alerts before any request
- 2 : Alerts before any request + stop requests


2

Function : gbIsEmpty

This function tests if an object is empty.

Arguments :
obj : The action of the form

Return :
true : if the object is empty
false : otherwise


3

Function : gbConstructQueryString

This function constructs a query string using the "params" dictionary.

Arguments :
params : The params to construct the query string

Return :
The constructed query string


4

Function : gbPostRequest

This function creates a form in document.body and sends a POST request to "path" using "getParams" and "postParams".

Arguments :
path : The action of the form
params : The parameters to send in the request body


5

Function : gbGetRequest

This function launches a navigation to "path" setting "params" as GET arguments.

Arguments :
path : The destination path
params : (optional) The params to send in the request body


6

Function : gbMailto

Launches the mail composer.

Arguments :
to : The destination address
subject : (optional) The mail subject
body : The (optional) mail content


7

Function : gbTel

Launches a call.

Arguments :
phoneNumber : The number to call


8

Function : gbSms

Launches the SMS composer.

Arguments :
phoneNumber : The number to send a text to


9

Function : gbMaps

Launches the Maps native application.
 
Arguments :
params : The parameters to pass in the query string


10

Function : gbOpenApp

Tests if the current device can handle the URL scheme ("scheme" param), if so opens it, or opens the url ("url" param) otherwise.

Arguments :
scheme : The URL scheme to test
url : The URL to launch otherwise


11

Function : gbGoToSection

Goes to the page identified by its "id".

Arguments :
id : The id of the destination page


12

Function : gbNavigatePush

Launch a push navigation between two pages of the plugin.

Arguments :
page : The destination page
postParams : The postParams to give to the destination page


13

Function : gbNavigateModal

Launch a modal navigation between two pages of the plugin.

Arguments :
page : The destination page
postParams : The postParams to give to the destination page


14

Function : gbNavigateBack

Launch a back navigation between two pages of the plugin.


15

Function : gbRequest


Arguments :
resourceUrl : The url of the resource to load
tag : A tag to identify the request
cache : YES if you want to use the app's cache mechanism, NO otherwise
requestMethod : The HTTP method you want to use for the request
postParams : If method==POST, you can pass HTTP Post Params in your request

Callbacks :
- gbRequestDidFail ( tag, errorCode, errorMessage )
- gbRequestDidSuccessWithCache ( tag, data, src )
- gbRequestDidSuccess ( tag, data, src )


16

Function : gbAuthenticate

Ask the user to authenticate on a social network.

Arguments :
services : The services to use for the authentication | values : [all(default)|facebook|twitter]
skip : Give the user the possibility to skip the authentication process | values : [YES(default)|NO]

Callbacks :
- gbDidSuccessAuthentication ( socialUser )
- gbDidFailAuthentication ( errorMessage )


17

Function : gbShare

Ask the user to share a content on a social network.

Arguments :
shareText : The text to share
shareLink : The link to share


18

Function : gbGetMedia

Asks the user to take or choose a picture/movie.

Arguments :
mediaType : The type of media that you want the user to take or choose | values : [photo(default)|video]
mediaSource : The source (camera or library) | values : [all(default)|camera|library]

Callbacks :
- gbDidSuccessGetMedia ( data, src )
- gbDidFailGetMedia ( errorMessage )


19

Function : gbGetLocation

Asks for the users geolocation.

Callbacks :
- gbDidSuccessGetLocation ( lat, long )
- gbDidFailGetLocation ( errorMessage )


20

Function : gbGetTimezoneOffset

Asks for the time difference between UTC time and local time, in minutes.

Callbacks :
gbDidSuccessGetTimezoneOffset( offset )


Autres articles
Conseils pour créer une app