Cookies
Notes
-
Cookies.set(key, value[, days])
: saves a cookie- Defaults to 31 days if a value isn't provided
Cookies.get(key)
: gets a cookie
JavaScript
var exampleFunction = function () { FD.Cookies.set("exampleCookie", 123); FD.notify.info(FD.Cookies.get("exampleCookie")); };
Local Storage
Notes
Each of these functions is a simple wrapper around the localStorage object that checks to ensure the functionality is supported by the browser before executing the code.
LocalStorage.set(key, value)
: saves an item to local storageLocalStorage.get(key)
: gets an item from local storageLocalStorage.remove(key)
: deletes an item in local storage
JavaScript
var exampleFunction = function () { FD.LocalStorage.set('exampleStorageItem', 456); FD.notify.info('After Saving: ' + FD.LocalStorage.get('exampleStorageItem')); FD.LocalStorage.remove('exampleStorageItem'); FD.notify.info('After Removing: ' + FD.LocalStorage.get('exampleStorageItem')); };
Page
Notes
This is the default callback namespace. Additionally, the FD.Page.init
function is always called once the page is loaded. It is assumed that any page-specific functionality will be added inside this namespace.
JavaScript
FD.Page.init = function() { $('pre').codeEditor(); FD.notify.info('page load is complete!'); };
Utility
Notes
BlockUI
Utility.blockUI()
: starts a block over the entire pageUtility.unblockUI()
: removes a whole-page blockUtility.blockUI(element)
: blocks out an element on the pageUtility.unblockUI(element)
: removes a block on an element
JavaScript
var exampleFunction = function () { FD.Utility.blockUI(); setTimeout(function () { FD.Utility.unblockUI(); }, 2000); };