freezr.info - Towards data freedom
freezr_core API

The freezr_core API is a set of javascript functions for accessing the database, accessing uploaded files, managing permissioning, and rendering pages.

So each freezr app page includes the freezr api (found in freezr_core.js) with the following functions:

db: Database functions...
  • write (data [, options] [, callback]): Write to the database.
  • update (data [, options [, callback] ]): Update a record in the database.
  • upload (file [, options [, callback] ]): Upload a file and record it in the database.
  • getById (data_object_id [, options [, callback]]): Get object by id
  • query ([options [, callback] ]): Query database
  • perms: Granting and reading permissions...
  • getAllAppPermissions (callback): Gets a list of permissions granted by the user to the app.
  • setObjectAccess (permission_name, data_object_id, options, callback): Gives specific users rights to a specific record.
  • utils: Functions for rendering html or referring to files from html
  • getConfig (callback): Developer function to get the app_config and the list of colelction_names used.
  • ping (callback): Pings server to see if it is available.
  • logout (): Logs out of freezr
  • getHtml (part_path, app_name, callback): Gets an html file on the freezr server.
  • getAllAppList (callback): Gets a JSON of all the user's apps.
  • filePathFromName (fileName, options): Creates full url or path to a file from a file name so that the file can be referred to in html.
  • freezrMenuOpen (): Opens the freezr menu (on the top right of the app.)
  • freezrMenuClose (): Closes the freezr menu (on the top right of the app.)
  • app: Functions and variables for creating stand-alone apps with the likes of phonegap or electron, which are not accessed online via a web browser.
  • isWebBased: false by default. This should be set to true in the index.html of stand alone apps to indicate it is a standalone app
  • loginCallback: This can be set to a function which will be called when the user logs in, so that the app can do any necessary initialization.
  • logoutCallback: This can be set to a function which will be called when the user logs out, so that the app can do any necessary re-adjustments like deleting variables and local storage items.
  • initPageScripts: A special function, null by default that can be defined for each app, and whch is run after the app page has been created.
    onFreezrMenuClose (hasChanged) : A special function, null by default that can be defined for each app, and is called when the freezr menu is closed. An app can define this to perform specific actions when a user grants or denies a new permission. ("hasChanged" indicates if the user has granted or denied a permission.)