When you create a new project, there is a template (Thorium API) that implements the available API functions.
thoriumapi.isLocal()
Return true if the App is runiing with file:// protocol
logEvent(level, message)
Send a message to TB Console (levels: 0=info, 1=Warning 2=Error)
loadpage: function (page, param, transition) {
Load a page from its name and with optional parameters and transition type. Possible ,transitions are
f7-circle
f7-cover
f7-cover-v
f7-dive
f7-fade
f7-flip
f7-parallax
f7-push
Example: thoriumapi.loadpage("mypage", null, "f7-cover-v");
showAlert(message) {
Show an Alert
reloadHomePage
go back to Home page (index)
backToPreviousPage
go back to previous page.
Example: thoriumapi.backToPreviousPage();
showNotification: function (message, timeout, icon, cssClass, subtitle, title)
Open a Notification.
Exemple: thoriumapi.showNotification("Message Content", 3000, null, null, "This is a subtitle","title");
showToast: function (text, closeButton, position, closeTimeout, icon)
Open a Toast Message.
Exemple: thoriumapi.thoriumapi.showToast("Message Content", true, "bottom", 3000, null);
thoriumapi.localstorage.isAvailable()
thoriumapi.localstorage.setItem: function (key, value)
thoriumapi.localstorage.getItem(key)
thoriumapi.localstorage.removeItem(key)
thoriumapi.localstorage.clear()
thoriumapi.sessionstorage.isAvailable()
thoriumapi.sessionstorage.setItem: function (key, value)
thoriumapi.sessionstorage.getItem(key)
thoriumapi.sessionstorage.removeItem(key)
thoriumapi.sessionstorage.clear()
thoriumapi.geolocation.isAvailable()
thoriumapi.geolocation.setPosition(pos)
thoriumapi.geolocation.getCurrentPosition()
thoriumapi.geolocation.watchPosition()
thoriumapi.geolocation.clearWatch()
thoriumapi.osm.getMapInstance(id);
Get a Leaflet Map Instance
Example: var map=thoriumapi.osm.getMapInstance("osm_map");
From the map reference, you have access to all the functionnalities implemented in leaflet.js: https://leafletjs.com
Manipulate Repeaters data (Json Api, Firebase and dbExpress)
thoriumapi.repeaters.getVirtualList(id);
Get the Repeater Virtual List object
thoriumapi.repeaters.getAllItems(id);
Returns all items from the repeater
thoriumapi.repeaters.getItemAt(id,index);
Returns item at index from the repeater with id
thoriumapi.repeaters.getFilteredItems(id);
Returns all filtered items from a repeater (when used with a search box)
thoriumapi.repeaters.clear(id);
Clear a Repeater
thoriumapi.repeaters.appendItem(id,item);
Add an Item to a Repeater
thoriumapi.repeaters.replaceItemAt(id,index,item);
Replace an Item in a Repeater
thoriumapi.repeaters.removeItemAt(id,index);
Remove an Item from a Repeater
thoriumapi.repeaters.scrollToItem(id,index);
Scroll to an Item in a Repeater
thoriumapi.repeaters.moveItem(id,index,newpos);
Move an Item to a new position in a Repeater
thoriumapi.repeaters.itemsCount(id);
Returns the number of Items in a Repeater
thoriumapi.repeaters.reload(id);
Reload a Repeater
thoriumapi.dbexpress.getToken()
Return the current user token
thoriumapi.dbexpress.showResetPasswordScreen();
Load the Reset Password Dialog
thoriumapi.dbexpress.showSigninPopup();
Load the SignIn Dialog
thoriumapi.dbexpress.showTermsPopup();
Load the "Terms of Use" Dialog
thoriumapi.dbexpress.showPrivacyPopup();
Load the "Privacy Policy" Dialog
thoriumapi.dbexpress.showProfileScreen();
Load the "Profile" Dialog
thoriumapi.dbexpress.showRegisterPopup();
Load the "Register" Dialog
thoriumapi.dbexpress.signIn(email, password);
SigIn with email & password
thoriumapi.dbexpress.logout();
Kill the current session
thoriumapi.dbexpress.getCurrentUser();
Return an object with all connected user information
thoriumapi.dbexpress.executeCustomService(service,callback);
Execute a custom service with a callback function
thoriumapi.dbexpress.postData(service,data,callback);
Post data to a table with a callback function. If the UID is passed in data, then the Web service will try to perform an Update (Else Insert by default)
Read GoogleMap API documentation at https://developers.google.com/maps/documentation for more advanced features.
thoriumapi.googleMap.getGoogleMapObject(id)
example: var map=thoriumapi.googleMap.getGoogleMapObject("obj-1044");
thoriumapi.googleMap.reloadMapData(id)
Example: thoriumapi.googleMap.reloadMapData("obj-1044");
thoriumapi.googleMap.centerMapAtPosition(id,lat,lng)
Example: thoriumapi.googleMap.centerMapAtPosition("obj-1044",48.87,2.33);
thoriumapi.googleMap.setZoom(id,level)
Example: thoriumapi.googleMap.setZoom("obj-1044",3);
thoriumapi.googleMap.getZoom(id)
Example: var z=thoriumapi.googleMap.getZoom("obj-1044");
thoriumapi.googleMap.getCenter(id)
Example: var center=thoriumapi.googleMap.getCenter("obj-1044");
thoriumapi.googleMap.setCenter(id,lat,lng)
Example: thoriumapi.googleMap.setCenter("obj-1044",48.87,2.33);
thoriumapi.googleMap.drawCircleAtPos(id,lat,lng,size)
Example: thoriumapi.googleMap.drawCircleAtPos("obj-1044",46.45,2.25,600000);
thoriumapi.googleMap.panTo(id,lat,lng)
Example: thoriumapi.googleMap.panTo("obj-1044",46.45,2.25);
thoriumapi.googleMap.setOptions(id,options)
Example:
var options = {
zoom:11,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP,
panControl: false
};
thoriumapi.googleMap.setOptions("obj-1044",options);
Read https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions for more details about options.
thoriumapi.googleMap.addMarker (id,lat,lng,data)
Example:
var data={};
data.title="PARIS";
thoriumapi.googleMap.addMarker("obj-1044",46.45,2.25,data)
...