Thorium API

Developer Edition

General
  • 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-circlef7-coverf7-cover-vf7-divef7-fadef7-flipf7-parallaxf7-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);


localstorage
  • thoriumapi.localstorage.isAvailable()

  • thoriumapi.localstorage.setItem: function (key, value)

  • thoriumapi.localstorage.getItem(key)

  • thoriumapi.localstorage.removeItem(key)

  • thoriumapi.localstorage.clear()


sessionstorage
  • thoriumapi.sessionstorage.isAvailable()

  • thoriumapi.sessionstorage.setItem: function (key, value)

  • thoriumapi.sessionstorage.getItem(key)

  • thoriumapi.sessionstorage.removeItem(key)

  • thoriumapi.sessionstorage.clear()


geolocation
  • thoriumapi.geolocation.isAvailable()

  • thoriumapi.geolocation.setPosition(pos)

  • thoriumapi.geolocation.getCurrentPosition()

  • thoriumapi.geolocation.watchPosition()

  • thoriumapi.geolocation.clearWatch()


Open Street Map / Leaflet.js
  • 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


Repeaters

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


dbExpress
3.3.0

You can download an example app here: https://www.thoriumbuilder.com/tutorial_detail.html?id=174063616

  • 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)


googleMap
3.3.0

Read GoogleMap API documentation at https://developers.google.com/maps/documentation for more advanced features.

You can also download an example app here: https://thoriumbuilder.com/downloads/templates/googlemap_api_3_3.hbt.zip

  • 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)

Copyright©  Nymphide Lab 2020 - All Rights Reserved 

...