fluro
Version:
Promise based HTTP Fluro client for the browser and node.js
448 lines (340 loc) • 21.4 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>fluro.app.js - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="access.html">access</a><ul class='methods'><li data-type='method'><a href="access.html#.addEventListener">addEventListener</a></li><li data-type='method'><a href="access.html#.can">can</a></li><li data-type='method'><a href="access.html#.canDeleteItem">canDeleteItem</a></li><li data-type='method'><a href="access.html#.canEditItem">canEditItem</a></li><li data-type='method'><a href="access.html#.canKnowOf">canKnowOf</a></li><li data-type='method'><a href="access.html#.canViewItem">canViewItem</a></li><li data-type='method'><a href="access.html#.has">has</a></li><li data-type='method'><a href="access.html#.isAuthor">isAuthor</a></li><li data-type='method'><a href="access.html#.removeAllListeners">removeAllListeners</a></li><li data-type='method'><a href="access.html#.removeEventListener">removeEventListener</a></li><li data-type='method'><a href="access.html#.retrieveActionableRealms">retrieveActionableRealms</a></li><li data-type='method'><a href="access.html#.retrieveCurrentSession">retrieveCurrentSession</a></li><li data-type='method'><a href="access.html#.setDefaultApplication">setDefaultApplication</a></li></ul></li><li><a href="api.html">api</a><ul class='methods'><li data-type='method'><a href="api.html#.delete">delete</a></li><li data-type='method'><a href="api.html#.generateEndpointURL">generateEndpointURL</a></li><li data-type='method'><a href="api.html#.get">get</a></li><li data-type='method'><a href="api.html#.post">post</a></li><li data-type='method'><a href="api.html#.put">put</a></li></ul></li><li><a href="app.device.html">device</a></li><li><a href="asset.html">asset</a><ul class='methods'><li data-type='method'><a href="asset.html#.avatarUrl">avatarUrl</a></li><li data-type='method'><a href="asset.html#.downloadUrl">downloadUrl</a></li><li data-type='method'><a href="asset.html#.filesize">filesize</a></li><li data-type='method'><a href="asset.html#.getUrl">getUrl</a></li><li data-type='method'><a href="asset.html#.imageUrl">imageUrl</a></li><li data-type='method'><a href="asset.html#.playerUrl">playerUrl</a></li><li data-type='method'><a href="asset.html#.posterUrl">posterUrl</a></li><li data-type='method'><a href="asset.html#.typeFromMime">typeFromMime</a></li></ul></li><li><a href="auth.html">auth</a><ul class='methods'><li data-type='method'><a href="auth.html#.addEventListener">addEventListener</a></li><li data-type='method'><a href="auth.html#.changeAccount">changeAccount</a></li><li data-type='method'><a href="auth.html#.getCurrentToken">getCurrentToken</a></li><li data-type='method'><a href="auth.html#.getCurrentUser">getCurrentUser</a></li><li data-type='method'><a href="auth.html#.impersonate">impersonate</a></li><li data-type='method'><a href="auth.html#.login">login</a></li><li data-type='method'><a href="auth.html#.logout">logout</a></li><li data-type='method'><a href="auth.html#.refreshAccessToken">refreshAccessToken</a></li><li data-type='method'><a href="auth.html#.removeAllListeners">removeAllListeners</a></li><li data-type='method'><a href="auth.html#.removeEventListener">removeEventListener</a></li><li data-type='method'><a href="auth.html#.retrieveUserFromResetToken">retrieveUserFromResetToken</a></li><li data-type='method'><a href="auth.html#.sendResetPasswordRequest">sendResetPasswordRequest</a></li><li data-type='method'><a href="auth.html#.set">set</a></li><li data-type='method'><a href="auth.html#.signup">signup</a></li><li data-type='method'><a href="auth.html#.updateUserWithToken">updateUserWithToken</a></li></ul></li><li><a href="cache.html">cache</a><ul class='methods'><li data-type='method'><a href="cache.html#.get">get</a></li><li data-type='method'><a href="cache.html#.reset">reset</a></li></ul></li><li><a href="components.html">components</a><ul class='methods'><li data-type='method'><a href="components.html#.hydrateModel">hydrateModel</a></li></ul></li><li><a href="content.html">content</a><ul class='methods'><li data-type='method'><a href="content.html#.duplicate">duplicate</a></li><li data-type='method'><a href="content.html#.external">external</a></li><li data-type='method'><a href="content.html#.filter">filter</a></li><li data-type='method'><a href="content.html#.form">form</a></li><li data-type='method'><a href="content.html#.get">get</a></li><li data-type='method'><a href="content.html#.getMultiple">getMultiple</a></li><li data-type='method'><a href="content.html#.keys">keys</a></li><li data-type='method'><a href="content.html#.list">list</a></li><li data-type='method'><a href="content.html#.query">query</a></li><li data-type='method'><a href="content.html#.related">related</a></li><li data-type='method'><a href="content.html#.retrieve">retrieve</a></li><li data-type='method'><a href="content.html#.slug">slug</a></li><li data-type='method'><a href="content.html#.submitInteraction">submitInteraction</a></li><li data-type='method'><a href="content.html#.submitPost">submitPost</a></li><li data-type='method'><a href="content.html#.thread">thread</a></li><li data-type='method'><a href="content.html#.values">values</a></li></ul></li><li><a href="date.html">date</a><ul class='methods'><li data-type='method'><a href="date.html#.countdown">countdown</a></li><li data-type='method'><a href="date.html#.dateFromID">dateFromID</a></li><li data-type='method'><a href="date.html#.formatDate">formatDate</a></li><li data-type='method'><a href="date.html#.getAge">getAge</a></li><li data-type='method'><a href="date.html#.groupEventByDate">groupEventByDate</a></li><li data-type='method'><a href="date.html#.isDifferentTimezoneThanUser">isDifferentTimezoneThanUser</a></li><li data-type='method'><a href="date.html#.isMultiDayEvent">isMultiDayEvent</a></li><li data-type='method'><a href="date.html#.localDate">localDate</a></li><li data-type='method'><a href="date.html#.militaryTimestamp">militaryTimestamp</a></li><li data-type='method'><a href="date.html#.readableEventDate">readableEventDate</a></li><li data-type='method'><a href="date.html#.readableEventTime">readableEventTime</a></li><li data-type='method'><a href="date.html#.timeago">timeago</a></li><li data-type='method'><a href="date.html#.timeline">timeline</a></li><li data-type='method'><a href="date.html#.timestampToAmPm">timestampToAmPm</a></li><li data-type='method'><a href="date.html#.timezones">timezones</a></li></ul></li><li><a href="fluro.html">fluro</a></li><li><a href="types.html">types</a><ul class='methods'><li data-type='method'><a href="types.html#.all">all</a></li><li data-type='method'><a href="types.html#.basicTypes">basicTypes</a></li><li data-type='method'><a href="types.html#.get">get</a></li><li data-type='method'><a href="types.html#.mapDefinitionItems">mapDefinitionItems</a></li><li data-type='method'><a href="types.html#.parentType">parentType</a></li><li data-type='method'><a href="types.html#.postableTypes">postableTypes</a></li><li data-type='method'><a href="types.html#.readable">readable</a></li><li data-type='method'><a href="types.html#.reloadTerminology">reloadTerminology</a></li><li data-type='method'><a href="types.html#.retrieve">retrieve</a></li><li data-type='method'><a href="types.html#.subTypes">subTypes</a></li><li data-type='method'><a href="types.html#.term">term</a></li></ul></li><li><a href="utils.html">utils</a><ul class='methods'><li data-type='method'><a href="utils.html#.arrayIDs">arrayIDs</a></li><li data-type='method'><a href="utils.html#.comma">comma</a></li><li data-type='method'><a href="utils.html#.currencySymbol">currencySymbol</a></li><li data-type='method'><a href="utils.html#.errorMessage">errorMessage</a></li><li data-type='method'><a href="utils.html#.extractFromArray">extractFromArray</a></li><li data-type='method'><a href="utils.html#.formatCurrency">formatCurrency</a></li><li data-type='method'><a href="utils.html#.getDefaultValueForField">getDefaultValueForField</a></li><li data-type='method'><a href="utils.html#.getFlattenedFields">getFlattenedFields</a></li><li data-type='method'><a href="utils.html#.getStringID">getStringID</a></li><li data-type='method'><a href="utils.html#.guid">guid</a></li><li data-type='method'><a href="utils.html#.hash">hash</a></li><li data-type='method'><a href="utils.html#.injectScript">injectScript</a></li><li data-type='method'><a href="utils.html#.machineName">machineName</a></li><li data-type='method'><a href="utils.html#.mapParameters">mapParameters</a></li><li data-type='method'><a href="utils.html#.matchInArray">matchInArray</a></li><li data-type='method'><a href="utils.html#.processCardPrioritySort">processCardPrioritySort</a></li></ul></li><li><a href="video.html">video</a><ul class='methods'><li data-type='method'><a href="video.html#.hhmmss">hhmmss</a></li><li data-type='method'><a href="video.html#.readableMilliseconds">readableMilliseconds</a></li><li data-type='method'><a href="video.html#.readableSeconds">readableSeconds</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">fluro.app.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>///////////////////////////////////////////////////////////////////////////////
/**
* @classdesc A reactive VueJS service available only within apps and websites built with the Fluro Web Builder. It provides helpful functions including for navigating around your app, accessing native mobile APIs and playback of media content.
* @alias fluro.app
* @class
* @hideconstructor
*/
// //Setup a reactive object for our things
// var FluroApp = new Vue({
// data() {
// var session;
// if (process.browser) {
// var storedSession = window.localStorage.getItem('fluroAppUser');
// if (storedSession) {
// session = JSON.parse(storedSession);
// //console.log('retrieved user from storage');
// }
// }
// return {
// session,
// device: self.$fluro.device(),
// layers: [],
// builder: self,
// global: Vue.observable({}),
// audioPlayer: new Audio(),
// notifications: [],
// breadcrumb: BreadcrumbService,
// }
// },
// methods: {
// //$fluro.app.to({name:'home', query:'blah', params:{}});
// //$fluro.app.to('/something');
// to(to) {
// console.log('SET BUILDER ROUTE TO', to)
// return this.$fluro.app.setBuilderRoute(to);
// },
// notificationReceived(notification, userAction) {
// var self = this;
// self.notifications.push(notification);
// if (userAction) {
// var path = _.get(notification, 'data.path');
// if (path) {
// self.$router.push(path);
// }
// }
// self.$emit('notification', notification);
// },
// deviceMode() {
// return 'web';
// },
// getBuilder() {
// return self;
// },
// getPage(pageName) {
// var match;
// function findMatchingRoute(array, name) {
// _.each(array, function(route) {
// if (route.state == name) {
// match = route;
// return;
// }
// if (match) {
// return;
// }
// //We still don't have a match but there are sub routes
// if (route.routes && route.routes.length) {
// findMatchingRoute(route.routes, name);
// }
// })
// }
// /////////////////////////////////////////////
// findMatchingRoute(self.siteRoutes, pageName);
// return match;
// },
// setBuilderRoute(routeParams) {
// var match;
// // //console.log('Find match', routeParams);
// function findMatchingRoute(array, params) {
// _.each(array, function(route) {
// if (route.state == params.name) {
// match = route;
// return;
// }
// if (match) {
// return;
// }
// //We still don't have a match but there are sub routes
// if (route.routes && route.routes.length) {
// findMatchingRoute(route.routes, params);
// }
// })
// }
// ////////////////////////////////////////////////
// findMatchingRoute(self.siteRoutes, routeParams);
// if (!match) {
// return;
// }
// if (!match.testParams) {
// self.$set(match, 'testParams', routeParams.params);
// } else {
// _.assign(match.testParams, routeParams.params);
// }
// //console.log('SELECT ROUTE', match.testParams, routeParams)
// self.clickedRoute(match);
// // //console.log('MATCH', match, self.siteRoutes, routeParams);
// },
// addLayer(options, drawer, additional) {
// if (!options) {
// options = {};
// }
// var self = this;
// if (!drawer) {
// drawer = 'modal';
// }
// // var index = self.layers.length;
// return new Promise(function(resolve, reject) {
// var index = self.layers.length;;
// options.layerID = index;
// options.resolve = resolve;
// options.reject = reject;
// self.layers.push({ index, options, drawer });
// });
// },
// removeLayer(index) {
// var self = this;
// var matchingPanelIndex = _.findIndex(self.layers, { index: index });
// if (matchingPanelIndex != -1) {
// var target = self.layers[matchingPanelIndex];
// self.layers.splice(matchingPanelIndex, 1);
// if (target.options.resolve) {
// target.options.resolve();
// }
// }
// },
// clearLayers(drawer) {
// var layers = (this.layers || []).slice();
// this.layers = [];
// _.each(layers, function(layer) {
// layer.options.reject();
// })
// },
// // audioPlayer() {
// // //console.log('GET AUDIO', this.audioElement);
// // if(this.audioElement) {
// // //console.log('return existing audio element')
// // return this.audioElement;
// // }
// // if(!window) {
// // return;
// // }
// // var audio = new Audio();
// // this.$set(this, 'audioElement', audio);
// // //console.log('created new audio element')
// // return audio;
// // },
// },
// computed: {
// proMode() {
// return this.$pro.enabled;
// },
// user: {
// get() {
// return this.session;
// },
// set(payload) {
// if (this.session != payload) {
// this.session = payload;
// if (process.browser) {
// if (payload) {
// window.localStorage.setItem('fluroAppUser', JSON.stringify(payload));
// //console.log('saved user to storage');
// } else {
// window.localStorage.setItem('fluroAppUser', null);
// //console.log('removed user from storage');
// }
// }
// this.$emit('user', payload);
// }
// }
// },
// site() {
// return self.site;
// },
// themes() {
// return self.site.themes;
// },
// // breakpoint() {
// // // var width = 0;
// // // var height = 0;
// // // if (process.browser) {
// // // var width = Math.max(window.innerWidth || 0);
// // // var height = Math.max(window.innerHeight || 0);
// // // }
// // // var object = {
// // // xs: false,
// // // sm: false,
// // // md: false,
// // // lg: false,
// // // xl: false,
// // // xsOnly: false,
// // // smOnly: false,
// // // smAndDown: false,
// // // smAndUp: false,
// // // mdOnly: false,
// // // mdAndDown: false,
// // // mdAndUp: false,
// // // lgOnly: false,
// // // lgAndDown: false,
// // // lgAndUp: false,
// // // xlOnly: false,
// // // width,
// // // height,
// // // }
// // // if ()
// // },
// menu() {
// return _.reduce(this.site.menus, function(set, menu) {
// if (!menu) {
// return set
// }
// if (!menu.key) {
// return set
// }
// set[menu.key] = menu;
// return set;
// }, {});
// },
// page() {
// //console.log('DYNAMIC ROUTE', self.routeHREF)
// // //console.log('Dynamic items was changed', self.dynamicURLTokens, self.dynamicURLItems);
// var pageObject = {
// title: self.route.title,
// name: self.route.state,
// params: _.reduce(self.route.testParams || {}, function(set, value, key) {
// var cleanKey = _.camelCase(key);
// set[cleanKey] = value;
// return set
// }, {}),
// path: self.route.url,
// href: self.routeHREF,
// items: self.dynamicURLItems,
// query: {},
// }
// return pageObject;
// },
// },
// })
/**
* @alias app.device
* @class
* @hideconstructor
* @example
* //Get the device breakpoint and screen size information
*
* {
* "mounted": true,
* "screen": {
* "width": 310,
* "height": 590
* },
* "limits": {
* "xs": 600,
* "sm": 960,
* "md": 1264,
* "lg": 1904
* },
* "breakpoint": {
* "mobile": true,
* "tablet": false,
* "desktop": false,
* "xs": true,
* "sm": false,
* "md": false,
* "lg": false,
* "xl": false,
* "xsOnly": true,
* "smOnly": false,
* "smAndDown": true,
* "smAndUp": false,
* "mdOnly": false,
* "mdAndDown": true,
* "mdAndUp": false,
* "lgOnly": false,
* "lgAndDown": true,
* "lgAndUp": false,
* "xlOnly": false,
* "point": 0
* },
* "point": 0
* }
*/
var device = {};
/**
* The Fluro App Service
* @classdesc This service is only available within a website, dashboard or mobile app built in the Fluro Web Builder. It provides helful tools including functions for navigating around your app, accessing native mobile APIs and playback of media content.
*
* @alias app
* @class
* @hideconstructor
*/</code></pre>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Tue Jun 29 2021 08:38:17 GMT+1000 (Australian Eastern Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
</body>
</html>