/** @file NEW METHOD OF CALLING FRAMEWORK FUNCTIONS Starting with 2.1.X, we will be deprecating all the old functions. They will stay deprecated for a time, but will eventually be removed. Each object will have a single function called "callFunction". You will use this to call any of the existing functions, and any new functions going forward. New functions will only be available via "callFunction". callFunction(functionName, arguments) functionName - String arguments - Array Calls a framework function called "functionName", passing in the arguments from the "arguments" array. Each object has this function defined. Examples: OrionSystem.callFunction('logToConsole', [1, 'A log message']); // function with a single argument OrionStarletWindow.callFunction('hide', []); // function with no arguments OrionTearoffParent.callFunction('createTearoffChildFromURL', ['starlet_key_name', 'www.google.com', 'test tearoff', 100, 100, true]); // function with multiple arguments OrionDownload.callFunction('setErrorCallback', ['errorObject', 'errorCallbackFunction']); // setting callbacks NOTE on callbacks called by the framework There are some restrictions on how the framework can call callbacks in your javascript code. * You cannot use anonymous functions. * You must pass the string name of the callback function you want the framework to use, not the actual function as you would in native javascript. When defining a callback you want the framework to call, it must be split into two parts; the object and the function. For example, if you want the framework to call the function foo.barFunc(), you'll need to pass the string "foo" as the object, and the string "barFunc" as the function. If you have a toplevel function, just pass an empty string for the object. If you have a function many objects deep, like foo.bar.spam.funcName, pass the string "foo.bar.spam" as the object, and "funcName" as the function. This restriction is in place due to how the underlying technology is laid out. Generic Callback System Most callbacks sent by the framework use a generic event object to maintain consistancy. The idea is that you can lower the amount of custom callbacks, and just use a single (or a few) callbacks depending on your needs. The object looks like: event = { 'eventName': 'nameOfEvent', // custom args for the callback }; Example of a simple callback event(sleep notification): event = {'eventName': 'systemSleep'}; Example of a less simple callback event(mouse notification): event = { 'eventName': 'mouseEnter', 'mouseX' : 1186, 'mouseY' : 50 }; Putting it all together: function someCallback(event) { switch(event.eventName) { case 'systemSleep': OrionSystem.logToConsole("system is going to sleep!"); break; case 'mouseEnter': OrionSystem.logToConsole('mouseEnter : (' + event.mouseX + ', ' + event.mouseY + ')'); break; default: break; } } */ /* Starlet callbacks */ /** @callback callbackGeneric @desc Simply executed on some event. */ /** @callback callbackProv @desc Receiver of user's initial provisioning data. @arg {Object} provData - Contains user details and server credentials. */ /** @callback callbackData @desc Receiver of DataPackets from {@link Bus.ask} calls. @arg {Object} packet - {@link OrionObjects.DataPacket} @see {@link OrionObjects.DataPacket} */ /** @callback callbackEvent @this {Element} - Target of event. @arg {Object} event - Native or jQuery DOM event object. */ /** @callback callbackFrameworkEvent @arg {Boolean} state - Whether the adjective the callback is named after is true. @arg {Boolean} [instruction] - Whether the change is a result of an instruction from Connection as opposed to a genuine event. */ /* Framework events */ /** @event systemSleep @type {Object} @property {String} eventName - 'systemSleep' @see {@link OrionSystem.setSleepCallback} */ /** @event systemWake @type {Object} @property {String} eventName - 'systemWake' @see {@link OrionSystem.setWakeCallback} */ /** @event windowMinimize @type {Object} @property {String} eventName - 'windowMinimize' @see {@link OrionStarletWindow.setMinimizeCallback} */ /** @event windowUnminimize @type {Object} @property {String} eventName - 'windowUnminimize' @see {@link OrionStarletWindow.setMinimizeCallback} */ /** @event windowFocus @type {Object} @property {String} eventName - 'windowFocus' @see {@link OrionStarletWindow.setFocusCallback} */ /** @event windowUnfocus @type {Object} @property {String} eventName - 'windowUnfocus' @see {@link OrionStarletWindow.setFocusCallback} */ /** @event windowHidden @type {Object} @property {String} eventName - 'windowHidden' @see {@link OrionStarletWindow.setHiddenCallback} */ /** @event windowUnhidden @type {Object} @property {String} eventName - 'windowUnhidden' @see {@link OrionStarletWindow.setHiddenCallback} */ /** @event frameworkExit @type {Object} @property {String} eventName - 'frameworkExit' @see {@link OrionStarletWindow.setExitCallback} */ /** @event generateUniqueKey @type {Object} @property {String} eventName - 'generateUniqueKey' @property {String} identifier - Identifier passed in when generating key. @property {String} key - The unique key. @see {@link OrionSystem.generateUniqueKey} */ /** @event mouseEnter @type {Object} @property {String} eventName - 'mouseEnter' @property {Number} mouseX - X coordinate of mouse. @property {Number} mouseY - Y coordinate of mouse. @see {@link OrionStarletWindow.setMouseCallback} */ /** @event mouseLeave @type {Object} @property {String} eventName - 'mouseLeave' @property {Number} mouseX - X coordinate of mouse. @property {Number} mouseY - Y coordinate of mouse. @see {@link OrionStarletWindow.setMouseCallback} */ /** @event downloadProgress @type {Object} @property {String} eventName - 'downloadProgress' @property {Object.<Object>} downloads - List of active downloads indexed by key. @property {Number} downloads.curBytes - Amount downloaded so far. @property {Number} downloads.totalBytes - Filesize, requires content length response header. @see {@link OrionDownload.setProgressCallback} */ /** @event downloadFinish @type {Object} @property {String} eventName - 'downloadFinish' @property {String} key - Unique download key. @property {Number} totalDown - Amount downloaded, hopefully total filesize. @see {@link OrionDownload.setFinishCallback} */ /** @event downloadError @type {Object} @property {String} eventName - 'downloadError' @property {String} key - Unique download key. @property {String} errorText - Description of the error. @see {@link OrionDownload.setErrorCallback} */ /** @event downloadResponse @type {Object} @property {String} eventName - 'downloadResponse' @property {String} key - Unique download key. @property {Number} responseCode - Server response code. @property {String} eventName - Message from server. @see {@link OrionDownload.setResponseCallback} */ /** @event uploadProgress @type {Object} @property {String} eventName - 'uploadProgress' @property {Object.<Object>} uploads - List of active uploads indexed by key. @property {Number} uploads.curBytes - Amount uploaded so far. @property {Number} uploads.totalBytes - Local filesize. @see {@link OrionUpload.setProgressCallback} */ /** @event uploadFinish @type {Object} @property {String} eventName - 'uploadFinish' @property {String} key - Unique upload key. @property {Number} totalDown - Amount uploaded, hopefully total filesize. @see {@link OrionUpload.setFinishCallback} */ /** @event uploadError @type {Object} @property {String} eventName - 'uploadError' @property {String} key - Unique upload key. @property {String} errorText - Description of the error. @see {@link OrionUpload.setErrorCallback} */ /** @event uploadResponse @type {Object} @property {String} eventName - 'uploadResponse' @property {String} key - Unique upload key. @property {Number} responseCode - Server response code. @property {String} eventName - Message from server. @see {@link OrionUpload.setResponseCallback} */ /** @event childClosed @type {Object} @property {String} eventName - 'childClosed' @property {String} key - Framework name of starlet. @see {@link OrionTearoffParent.setChildClosedCallback} */ /** @event childLoaded @type {Object} @property {String} eventName - 'childLoaded' @property {String} key - Framework name of starlet. @see {@link OrionTearoffParent.setChildLoadedCallback} */ /** @event frameworkResize @type {Object} @property {String} eventName - 'frameworkResize' @property {Number} width - Width of Application window (px). @property {Number} height - Height of Application window (px). @see {@link OrionFramework.setResizeCallback} */ /** @event animationStep @type {Object} @property {String} eventName - 'animationStep' @property {Number} x - Horizontal step distance (px). @property {Number} y - Vertical step distance (px). @see {@link OrionConnection.setAnimationStepCallback} */ /** @event starletVisible @type {Object} @property {String} eventName - 'starletVisible' @property {Boolean} visible - Whether Starlet's WebView is visible. @see {@link OrionStarletWindow.setStarletVisibleCallback} */ /** @event updateProgressEvent @type {Object} @property {String} eventName - 'updateProgressEvent' @property {Number} current - Amount downloaded so far. @property {Number} total - Filesize, requires content length response header. @see {@link OrionUpdate.setProgressCallback} */ /** @event updateErrorEvent @desc Error codes: 2502 Update file not found on server, 2504 Error trying to save update file on disk, 2506 General download error, 2514 Access denied, 2515 URL for update file not found, 2622 Local file locked, 2624 Local file error, 2628 Local file permission error, 3000 Invalid CRC for update file, 3600 Network connectivity error, 3611 Network connectivity error, 4000 Generic/Unknown Error @type {Object} @property {String} eventName - 'updateErrorEvent' @property {Number} errorCode - Server response code. @see {@link OrionUpdate.setErrorCallback} */ /** @event lightboxClosed @type {Object} @property {String} eventName - 'lightboxClosed' @property {Number} name - Framework name of Starlet. @see {@link OrionLightbox.setClosedCallback} */ /** @event legacySettings @type {Object} @desc Legacy (<= 1.5) settings in live JSON. */ /** @event idleTime @type {Number} @desc System idle time in seconds. */ /** @event flashVersion @type {String} @desc Version of Flash installed on the System. */ /** @event localPath @type {String} @desc Path in the local filesystem. */ /** @event localUrl @type {String} @desc Local "file:///" URL. */ /** @event hasWebcam @type {Boolean} @desc Whether a webcam is present. */ /** @event hasMicrophone @type {Boolean} @desc Whether a microphone is present. */ /** @event localStarlets @type {Object} @desc Indexed representation of content in starlets.sql. */ /** @event orionappUrl @type {String} @desc URL received via orionapp link. */ /** @event frameworkSettings @type {Object} @desc Saved settings. @property {Boolean} start - Whether the Framework will start on logging into the OS. @property {Boolean} minimize - When start is true, whether framework will start minimized. @see {@link OrionConnection.getFrameworkSettings} */ /** @event animationReady @type {Boolean} @desc Whether Starlet transition is ready to proceed. */ /** @event animationComplete @type {Undefined} @desc Starlet transition animation is complete. */ /** @event visibleStarlet @type {String} @desc Name of currently visible Starlet. */ /** @event apiURL @type {String} @desc Fully hashed API URL, ready to request. */ /** @event clipboardData @type {Mixed} @desc Contents of system clipboard. */ /* Framework callbacks */ /** @callback keyboardCallback @arg {Number} eventType - 0|1 = keyDown, 2 = keyUp, 3 = keyChar @arg {Boolean} repeat - Whether the event is the result of a repeating key. @see {@link OrionConnection.setKeyboardShortcut} */ /** @callback crashCallback @arg {String} starletName - Framework name of Starlet. @arg {Number} status - 0 = abnormal termination, 1 = killed, 2 = crashed @see {@link OrionConnection.setCrashCallback} */ /** @callback animateStarletCallback @arg {String} starletName - Framework name of Starlet | 'next' | 'prev'. @arg {String} direction - 'up' | 'down' | 'left' | 'right' | 'none' @see {@link OrionConnection.setCrashCallback} */ /* Orion API */ /** @namespace OrionFramework @desc Contains useful information about the Framework and the System. */ /** @member {String} OrionFramework.version @desc Current Framework version. */ /** @member {String} OrionFramework.platform @desc Current hardware platform, "mac"|"windows" */ /** @member {String} OrionFramework.apiURL @desc Current API server location. */ /** @member {String} OrionFramework.deviceID @desc Current device ID. */ /** @member {String} OrionFramework.systemDownloadPath @desc ocal system's default download path. */ /** @member {String} OrionFramework.userPath @desc Local Application support path. */ /** @member {Boolean} OrionFramework.developerMode @desc Whether developer mode is enabled. */ /** @member {Boolean} OrionFramework.loadAllStarlets @desc Whether Connection should load all Starlets at once when starting up, determined by presence of loadAllStarlets.txt. (Deprecated) */ /** @member {String} OrionFramework.pathSeparator @desc Character used to delimit local paths on the current platform. */ /** @member {Boolean} OrionFramework.managedInstall @desc Whether the Framework is running in a managed environment (Windows only). @see {@link WIN} */ /** @member {String} OrionFramework.userToken @desc Token for determining which API server to use. (apitoken.txt) */ /** @member {Boolean} OrionFramework.devServer @desc Whether the Framework is running on the development network. */ /** @method OrionFramework.setResizeCallback @desc Sets a callback to be notified when the main framework window resizes. Uses the generic callback event. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires frameworkResize @see {@link OrionFramework.unsetResizeCallback} @example OrionFramework.setResizeCallback('','resizeCallback'); function resizeCallback(event) { if (event.eventName == 'frameworkResize') { OrionSystem.logToConsole('Framework window resized to width : ' + event.width + ', ' + event.height); } } */ /** @method OrionFramework.unsetResizeCallback @desc Clears the framework resize callback so events are no longer sent. @see {@link OrionFramework.setResizeCallback} */ /** @method OrionFramework.getLegacyNotificationSettings @desc Retrieves <=1.5 notification settings. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires legacySettings @example OrionFramework.getLegacyNotificationSettings('','notificationSettings'); function notificationSettings(notificationObject) { // notificationObject contains legacy settings } */ /** @namespace OrionSystem @desc Various system wide functions. */ /** @method OrionSystem.logToConsole @desc Logs message to the star2star.log file. Javascript console errors are automatically written there as well. The log message will be tagged with the logLevel passed in. @arg {Number} logLevel - Significance of message. 0 = debug, 1 = info, 2 = warning, 3 = error. @arg {String} message - Information to record in log file. @see {@link log} @example var num = 3; OrionSystem.logToConsole(1, 'This message brought to you by the number ' + num); */ /** @method OrionSystem.getSystemIdleTime @desc Returns the current system idle time in seconds to the callback you specify. The idle time is the amount of time that has passed without any keyboard or mouse activity. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires idleTime @example OrionSystem.getSystemIdleTime('', 'systemIdleTimeCallback'); function systemIdleTimeCallback(seconds) { OrionSystem.logToConsole('seconds idle : ' + seconds); } */ /** @method OrionSystem.getFlashVersion @desc Retrieves the Flash version installed on the system. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires flashVersion @example OrionSystem.getFlashVersion('', 'flashVersionCallback'); function flashVersionCallback(flashVersion) { OrionSystem.logToConsole('installed flash version : ' + flashVersion); } */ /** @method OrionSystem.openExternalURL @desc Opens the specified location using the System's default browser. @arg {String} url - Location to open externally. @example OrionSystem.openExternalURL('http://www.star2star.com'); */ /** @method OrionSystem.executeMailTo @desc Executes the mailTo string on the shell to open the default mail program. This needs to be a full mailto string, including the 'mailto:' prefix. @arg {String} mailTo - Recipient for a new mail message opened in the System's default client. @example OrionSystem.executeMailTo('mailto:dgooden@star2star.com'); */ /** @method OrionSystem.showOpenFileDialog @desc Shows the native open file dialog, and will call your callback with the path the user chooses. The return path will be empty if there is an error, or if the user cancels the dialog. Passing something for starletName will open it in that starlet's window, passing blank will use the current starlet window. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @arg {String} [starletName=<frontmost>] - Starlet to associate dialog with. @fires localPath @example OrionSystem.showOpenFileDialog('', 'openFileCallback', ''); function openFileCallback(path) { path ? OrionSystem.logToConsole('User chose file : ' + path) : OrionSystem.logToConsole('Error or user cancel'); } */ /** @method OrionSystem.showSaveFileDialog @desc Shows the native save file dialog and will send the user's chosen path to the callback specified. The path returned will be empty if there is an error, or if the user cancels the dialog. Passing something for starletName will open it in that starlet's window, passing blank will use the current starlet window. Defaults are not enforced, the user may still choose any path or extension. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @arg {String} [starletName=<frontmost>] - Starlet to associate dialog with. @arg {String} defaultFilename - Suggested filename to show in dialog, including extension. @arg {String} defaultFileExtension - Suggested filetype to show in dialog, excluding dot. @fires localPath @see {@link OrionSystem.showDirectoryDialog} @example OrionSystem.showSaveFileDialog('', 'saveFileCallback', '', 'test.txt', 'txt'); function saveFileCallback(path) { path ? OrionSystem.logToConsole('User wants to save file at : ' + path) : OrionSystem.logToConsole('Error or user cancel'); } } */ /** @method OrionSystem.showDirectoryDialog @desc Shows the native directory dialog and sends chosen path to the callback specified. The path returned will be empty if there is an error, or if the user cancels the dialog. Passing something for starletName will open it in that starlet's window, passing blank will use the current starlet window. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @arg {String} [starletName=<frontmost>] - Starlet to associate dialog with. @fires localPath @see {@link OrionSystem.showSaveFileDialog} @example OrionSystem.showDirectoryDialog('', 'directoryCallback', ''); function directoryCallback(path) { path ? OrionSystem.logToConsole('User chose directory : ' + path) : OrionSystem.logToConsole('Error or user cancel'); } } */ /** @method OrionSystem.saveTextDataToFile @desc Creates/overwrites a text file located at path with the contents of data. @arg {String} path - Location to create file. @arg {String} data - Characters to write to file. @see {@link OrionSystem.saveBinaryDataToFile} @example OrionSystem.saveTextDataToFile('/tmp/test.txt', 'This is some text data to save'); */ /** @method OrionSystem.saveBinaryDataToFile @desc Creates/overwrites a binary file located at path with the contents of data. You must base64 encode the binary data before sending it to the Framework. The Framework will decode the data and save the result as a binary file. @arg {String} path - Location to create file. @arg {String} data - Base64 encoded data to write to file. @see {@link OrionSystem.saveTextDataToFile} @example var base64EncodedData = getDataFromSomewhere(); OrionSystem.saveBinaryDataToFile('/tmp/test.bin', base64EncodedData); */ /** @method OrionSystem.copyToClipboard @desc Copies data to the system clipboard. @arg {String} data - Text to copy to clipboard. @example OrionSystem.copyToClipboard('This text will be put on the clipboard'); */ /** @method OrionSystem.showPDF @desc Opens the PDF located at path using the default system PDF reader. If one is not installed, this will do nothing. @arg {String} path - Location of PDF to open externally. @example OrionSystem.showPDF('/Users/dgooden/foo.pdf'); */ /** @method OrionSystem.launchExternalProgram @desc The framework will can an external program at path, passing in args. If takeFocus is set to false, the program will not come to the top. (On windows, this is merely a suggestion, a program needs to specifically handle this to work). Each element of the array is one of the arguments. If your argument needs to contain a space, it must be enclosed in double quotes. @arg {String} path - Location of program to launch. @arg {Array} args - Parameters to pass to program. @arg {Boolean} takeFocus - Whether the newly opened program should take focus from the Framework. @example var args = []; args[0] = '-foo'; args[1] = '--bar'; args[2] = 'spam'; // launches program with arguments: -foo --bar spam var args = []; args[0] = '"this is a single argument with spaces"'; // launches program with argument: "this is a single argument with spaces" var args = []; args[0] = '-v'; args[1] = '/tmp/test.txt'; OrionSystem.launchExternalProgram('/Users/dgooden/testProgram', args, false); */ /** @method OrionSystem.setSleepCallback @desc Sets a callback for the framework to call when the system goes to sleep. You can only have 1 sleep callback active per starlet. If you call this function a second time the new callback will be used. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires systemSleep @see {@link OrionSystem.unsetSleepCallback} @example OrionSystem.setSleepCallback('', 'sleepCallback'); function sleepCallback(event) { if (event.eventName == 'systemSleep') { OrionSystem.logToConsole('System is going to sleep!'); } } */ /** @method OrionSystem.unsetSleepCallback @desc Clears the callback set for sleep notifications. @see {@link OrionSystem.setSleepCallback} */ /** @method OrionSystem.setWakeCallback @desc Sets a callback for the framework to call when the system wakes from sleep. You can only have 1 wake callback active per starlet. If you call this function a second time the new callback will be used. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires systemWake @see {@link OrionSystem.unsetWakeCallback} @example OrionSystem.setWakeCallback('', 'wakeCallback'); function wakeCallback(event) { if (event.eventName == 'systemWake') { OrionSystem.logToConsole('System is waling from sleep!'); } } */ /** @method OrionSystem.unsetWakeCallback @desc Clears the callback set for wake notifications. @see {@link OrionSystem.setWakeCallback} */ /** @method OrionSystem.generateUniqueKey @desc Generates a unique id (UUID/GUID). Returns identifier in the callback so you can keep track of which unique id is for what. @arg {String} identifier - For tracking which key was generated by which call to this method. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires generateUniqueKey @example OrionSystem.generateUniqueKey('test', '', 'keyCallback'); function keyCallback(event) { if (event.eventName == 'generateUniqueKey') { var identifier = event.identifier, key = event.key; } } */ /** @method OrionSystem.doesCameraExist @desc Detects the presence of a webcam. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires hasWebcam @see {@link OrionFramework.doesMicrophoneExist} @example OrionSystem.doesCameraExist('', 'cameraCallback'); function cameraCallback(result) { if (result) { // camera exists } } */ /** @method OrionSystem.doesMicrophoneExist @desc Detects the presence of a microphone. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires hasMicrophone @see {@link OrionFramework.doesCameraExist} @example OrionSystem.doesMicrophoneExist('', 'microphoneCallback'); function microphoneCallback(result) { if (result) { // microphone exists } } */ /** @method OrionSystem.showDevTools @desc Opens a dev tools window for the Starlet in which the method is called. */ /** @method OrionSystem.createLogBundle @desc Zips up the current star2star logs, and returns the path on disk to the zip file via a callback. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires localPath @example OrionSystem.createLogBundle('', 'bundleCallback'); function bundleCallback(path) { // path is the fully qualified path on disk to the zip bundle } */ /** @method OrionSystem.getClipboardData @desc Copies (string only) data from the system clipboard and returns it to the specified callback. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires clipboardData @example OrionSystem.getClipboardData('', 'clipboardData'); function clipboardData(text) { // text is the data from the clipboard } */ /** @method OrionSystem.getLocalFileURL @desc Returns a file:/// URL for a local file path. @arg {String} path - Unqualified local path. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires localUrl @example OrionSystem.getLocalFileURL('/Users/dgooden/test pdf file.pdf', '', 'fileCallback'); function fileCallback(url) { // url is the local file path converted to "file:///Users/dgooden/test%20pdf%20file%20.pdf" } */ /** @namespace OrionStarletWindow @desc A collection of methods to get information about and control the Window a Starlet is running in. */ /** @method OrionStarletWindow.activate @desc Brings the Window your Starlet is in to the foreground. @see {@link OrionConnection.activateWindow} */ /** @method OrionStarletWindow.show @desc Shows the Window the Starlet is in. @see {@link OrionStarletWindow.hide} */ /** @method OrionStarletWindow.hide @desc Hides the Window the Starlet is in. @see {@link OrionStarletWindow.show} */ /** @method OrionStarletWindow.resize @desc Resizes the Window the Starlet is in to specified dimensions. @arg {Number} width - Desired Window width (px). @arg {Number} height - Desired Window height (px). @see {@link OrionConnection.resizeWindow} */ /** @method OrionStarletWindow.setMinimizeCallback @desc Sets a callback to be notified when the window minimizes or unminimizes. When you set the callback, you'll immediately get notified of the current state. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires windowMinimize @fires windowUnminimize @see {@link OrionStarletWindow.unsetMinimizeCallback} @example OrionStarletWindow.setMinimizeCallback('', 'minimizeCallback'); function minimizeCallback(event) { if (event.eventName == 'windowMinimize') { OrionSystem.logToConsole('window is minimized'); } else if (event.eventName == 'windowUnminimize') { OrionSystem.logToConsole('window is unminimized'); } } */ /** @method OrionStarletWindow.unsetMinimizeCallback @desc Clears the callback so minimize events are no longer sent. @see {@link OrionStarletWindow.setMinimizeCallback} */ /** @method OrionStarletWindow.setFocusCallback @desc Sets a callback to be notified when the window gains or loses focus. When you set the callback, you'll immediately get notified of the current state. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires windowFocus @fires windowUnfocus @see {@link OrionStarletWindow.unsetFocusCallback} @example OrionStarletWindow.setFocusCallback('', 'focusCallback'); function focusCallback(event) { if (event.eventName == 'windowFocus') { OrionSystem.logToConsole('window gained focus'); } else if (event.eventName == 'windowUnfocus') { OrionSystem.logToConsole('window lost focus'); } } */ /** @method OrionStarletWindow.unsetFocusCallback @desc Clears the callback so focus events are no longer sent. @see {@link OrionStarletWindow.setFocusCallback} */ /** @method OrionStarletWindow.setHiddenCallback @desc Sets a callback to be notified when the window gets hidden or shown. When you set the callback, you'll immediately get notified of the current state. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires windowHidden @fires windowUnhidden @see {@link OrionStarletWindow.unsetHiddenCallback} @example OrionStarletWindow.setHiddenCallback('', 'hiddenCallback'); function hiddenCallback(event) { if (event.eventName == 'windowHidden') { OrionSystem.logToConsole('window is hidden'); } else if (event.eventName == 'windowUnhidden') { OrionSystem.logToConsole('window is no longer hidden'); } } */ /** @method OrionStarletWindow.unsetHiddenCallback @desc Clears the callback so hide events are no longer sent. @see {@link OrionStarletWindow.setHiddenCallback} */ /** @method OrionStarletWindow.setMouseCallback @desc Sets a callback to be notified when the mouse enters or leaves your starlet. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires mouseEnter @fires mouseLeave @see {@link OrionStarletWindow.unsetMouseCallback} @example OrionStarletWindow.setMouseCallback('', 'mouseCallback'); function mouseCallback(event) { if (event.eventName == 'mouseEnter') { OrionSystem.logToConsole('mouse entered starlet (' + event.mouseX + ',' + event.mouseY + ')'); } else if (event.eventName == 'mouseLeave') { OrionSystem.logToConsole('mouse left starlet (' + event.mouseX + ',' + event.mouseY + ')'); } } */ /** @method OrionStarletWindow.unsetMouseCallback @desc Clears the callback so mouse events are no longer sent. @see {@link OrionStarletWindow.setMouseCallback} */ /** @method OrionStarletWindow.setStarletVisibleCallback @desc Sets a callback to be notified when your Starlet is made visible or not visible due to navigation. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires starletVisible @see {@link OrionStarletWindow.unsetStarletVisibleCallback} @example OrionStarletWindow.setStarletVisibleCallback('', 'visibleCallback'); function visibleCallback(event) { if (event.eventName == 'starletVisible') { // event.visible will be true or false depending on if you are visible or not. } } */ /** @method OrionStarletWindow.unsetStarletVisibleCallback @desc Clears the callback so visible events are no longer sent. @see {@link OrionStarletWindow.setStarletVisibleCallback} */ /** @namespace OrionSimpleSoundPlayer @desc Plays very small and simple sounds, used for notifications. */ /** @method OrionSimpleSoundPlayer.playSound @desc Plays the named sound. @arg {String} soundName - Name of sound to play. Can be: 'bottle', 'bounce', 'chime', 'ding', 'doorbell', 'happy', 'keyboard', 'phaser', 'space', 'undersea'. */ /** @namespace OrionDownload @desc Provides a way to download one or many files concurrently, or to monitor other downloads in progress. */ /** @method OrionDownload.downloadFile @desc Initiate the download of a file from a URL to path. @arg {String} key - A unique value for monitoring/controlling the download, suggest using {@link OrionSystem.generateUniqueKey}. @arg {String} url - Remote source. @arg {String} path - Local destination. @see {@link OrionDownload.stopDownload} @example OrionDownload.downloadFile('000000-000000-00000-0000', 'http://www.example.com/foo.tar.gz', '/Users/dgooden/foo.tar.gz'); */ /** @method OrionDownload.stopDownload @desc Stops a download identified by key. @arg {String} key - Unique identifier of download. @see {@link OrionDownload.downloadFile} */ /** @method OrionDownload.setProgressCallback @desc Sets a callback that will be called by the framework during a file download. Normal starlets will just get information about downloads they initiated, while the connection starlet will see all of them. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires downloadProgress @see {@link OrionDownload.unsetProgressCallback} @example OrionDownload.setProgressCallback('', 'downloadProgressCallback'); function downloadProgressCallback(event) { if (event.eventName == 'downloadProgress') { for (var key in event.downloads) { var cur = event.downloads[key].curBytes, total = event.downloads[key].totalBytes; // ... } } } */ /** @method OrionDownload.unsetProgressCallback @desc Clears the download progress callback, stopping those events from being sent. @see {@link OrionDownload.setProgressCallback} */ /** @method OrionDownload.setFinishCallback @desc Sets a callback to alert you when a download has finished. This will not be fired if the download fails or is cancelled. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires downloadFinish @see {@link OrionDownload.unsetFinishCallback} @example OrionDownload.setFinishCallback('', 'downloadFinishCallback'); function downloadFinishCallback(event) { if (event.eventName == 'downloadFinish') { var key = event.key, totalBytesDownloaded = event.totalDown; // ... } } */ /** @method OrionDownload.unsetFinishCallback @desc Clears the download finish callback, stopping those events from being sent. @see {@link OrionDownload.setFinishCallback} */ /** @method OrionDownload.setErrorCallback @desc Sets a callback to alert you when a download fails. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires downloadError @see {@link OrionDownload.unsetErrorCallback} @example OrionDownload.setErrorCallback('', 'downloadErrorCallback'); function downloadErrorCallback(event) { if (event.eventName == 'downloadError') { var key = event.key, errorMessage = event.errorText; // ... } } */ /** @method OrionDownload.unsetErrorCallback @desc Clears the download error callback, stopping those events from being sent. @see {@link OrionDownload.setErrorCallback} */ /** @method OrionDownload.setResponseCallback @desc Sets a callback to get response data from the server after an download. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires downloadResponse @see {@link OrionDownload.unsetResponseCallback} @example OrionDownload.setResponseCallback('', 'downloadResponseCallback'); function downloadResponseCallback(event) { if (event.eventName == 'downloadResponse') { var key = event.key, responseCode = event.responseCode, responseBody = event.responseBody; // ... } } */ /** @method OrionDownload.unsetResponseCallback @desc Clears the download response callback, stopping those events from being sent. @see {@link OrionDownload.setResponseCallback} */ /** @namespace OrionUpload @desc Provides a way to upload one or many files concurrently, or to monitor other uploads in progress. */ /** @method OrionUpload.uploadFile @desc Initiate an upload of a file to url, using the formValue (if needed). @arg {String} key - A unique value for monitoring/controlling the upload, suggest using {@link OrionSystem.generateUniqueKey}. @arg {String} url - Remote destination. @arg {String} fileFormValue - Name of parameter server expects file data to be associated with. Must not be a key in formValues. @arg {Array.<String>} fileArray - List of local paths of files to upload. @arg {Object} formValues - Index of keys and values to send with file data. Must not contain a key equal to fileFormValue. @see {@link OrionUpload.uploadFileToAPI} @see {@link OrionUpload.stopUpload} @example OrionUpload.uploadFile('000000-000000-00000-0000', 'http://www.example.com/upload_file.php', 'file', ['/Users/dgooden/foo.tar.gz'], {'foo': 'bar'}); */ /** @method OrionUpload.uploadFileToAPI @desc The usage is exactly the same as {@link OrionUpload.uploadFile}. It just will call the API instead of a normal server. Pass '/v5/some/api/call' as the url. @arg {String} key - A unique value for monitoring/controlling the upload, suggest using {@link OrionSystem.generateUniqueKey}. @arg {String} url - Remote destination. @arg {String} fileFormValue - Name of parameter server expects file data to be associated with. Must not be a key in formValues. @arg {Array.<String>} fileArray - List of local paths of files to upload. @arg {Object} formValues - Index of keys and values to send with file data. Must not contain a key equal to fileFormValue. @see Stops an upload identified by key. @see {@link OrionUpload.stopUpload} @example OrionUpload.uploadFile('000000-000000-00000-0000', '/v5/some/api/call', 'file', ['/Users/dgooden/foo.tar.gz'], {'foo': 'bar'}); */ /** @method OrionUpload.stopUpload @desc Stops an upload identified by key. @arg {String} key - Unique identifier of upload. @see {@link OrionUpload.uploadFile} @see {@link OrionUpload.uploadFileToAPI} */ /** @method OrionUpload.setProgressCallback @desc Sets a callback that will be called by the framework during a file upload. Normal starlets will just get information about uploads they initiated, while the connection starlet will see all of them. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires uploadProgress @see {@link OrionUpload.unsetProgressCallback} @example OrionUpload.setProgressCallback('', 'uploadProgressCallback'); function uploadProgressCallback(event) { if (event.eventName == 'uploadProgress') { for (var key in event.uploads) { var cur = event.uploads[key].curBytes, total = event.uploads[key].totalBytes; // ... } } } */ /** @method OrionUpload.unsetProgressCallback @desc Clears the upload progress callback, stopping those events from being sent. @see {@link OrionUpload.setProgressCallback} */ /** @method OrionUpload.setFinishCallback @desc Sets a callback to alert you when an upload has finished. This will not be fired if the upload fails or is cancelled. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires uploadFinish @see {@link OrionUpload.unsetFinishCallback} @example OrionUpload.setFinishCallback("","uploadFinishCallback"); function uploadFinishCallback(event) { if (event.eventName == 'uploadFinish') { var key = event.key, totalBytesUploaded = event.totalUploaded; // ... } } */ /** @method OrionUpload.unsetFinishCallback @desc Clears the upload finish callback, stopping those events from being sent. @see {@link OrionUpload.setFinishCallback} */ /** @method OrionUpload.setErrorCallback @desc Sets a callback to alert you when an upload fails. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires uploadError @see {@link OrionUpload.unsetErrorCallback} @example OrionUpload.setErrorCallback('', 'uploadErrorCallback'); function uploadErrorCallback(event) { if (event.eventName == 'uploadError') { var key = event.key, errorMessage = event.errorText; // ... } } */ /** @method OrionUpload.unsetErrorCallback @desc Clears the upload error callback, stopping those events from being sent. @see {@link OrionUpload.setErrorCallback} */ /** @method OrionUpload.setResponseCallback @desc Sets a callback to get response data from the server after an upload. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires uploadResponse @see {@link OrionUpload.unsetResponseCallback} @example OrionUpload.setResponseCallback('', 'uploadResponseCallback'); function uploadResponseCallback(event) { if (event.eventName == 'uploadResponse') { var key = event.key, responseCode = event.responseCode, responseBody = event.responseBody; // ... } } */ /** @method OrionUpload.unsetResponseCallback @desc Clears the upload response callback, stopping those events from being sent. @see {@link OrionUpload.setResponseCallback} */ /** @namespace OrionTearoff @desc Interface to create and manage tearoffs. */ /** @method OrionTearoff.create @desc Creates a tearoff of your starlet, moving it from the framework to it's own window. @see {@link OrionTearoff.remove} */ /** @method OrionTearoff.remove @desc Removes your starlet from the tearoff and reinserts it into the framework. @see {@link OrionTearoff.create} */ /** @namespace OrionTearoffParent @desc Creating and managing mini-tearoffs. */ /** @method OrionTearoffParent.createTearoffChildFromURL @desc Creates a mini-tearoff from the URL specified. @arg {String} starletKey - Framework name of new Starlet. @arg {String} url - Location to load into the new WebView. @arg {String} title - Display title of new application window. @arg {Number} width - Desired width of new application window. Capped at width of screen, 0 will fill width of screen. @arg {Number} height - Desired height of new application window. Capped at height of screen, 0 will fill height of screen. @arg {Boolean} borderless - Whether to remove GUI chrome from the new application window, leaving only the WebView visible. @see {@link OrionTearoffParent.createHiddenTearoffChildFromURL} @see {@link OrionStarletWindow.show} @see {@link OrionStarletWindow.hide} @example OrionTearoffParent.createTearoffChildFromURL('starlet_key', 'http://www.google.com', 'Google test window', 800, 600, false); */ /** @method OrionTearoffParent.createHiddenTearoffChildFromURL @desc Creates a hidden mini-tearoff from the URL specified. @arg {String} starletKey - Framework name of new Starlet. @arg {String} url - Location to load into the new WebView. @arg {String} title - Display title of new application window. @arg {Number} width - Desired width of new application window. Capped at width of screen, 0 will fill width of screen. @arg {Number} height - Desired height of new application window. Capped at height of screen, 0 will fill height of screen. @arg {Boolean} borderless - Whether to remove GUI chrome from the new application window, leaving only the WebView visible. @see {@link OrionTearoffParent.createTearoffChildFromURL} @see {@link OrionStarletWindow.show} @see {@link OrionStarletWindow.hide} @example OrionTearoffParent.createHiddenTearoffChildFromURL('starlet_key', 'http://www.google.com', 'Google test window', 800, 600, false); */ /** @method OrionTearoffParent.messageChild @desc Calls a javascript function (identified by objectName and functionName), using arguments in the mini-tearoff starlet identified by starletKey. You are only allowed to message the mini-tearoff if you created it. @arg {String} starletKey - Framework name of Starlet. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @arg {Array.<Object|Array|String|Number|Boolean>} arguments - Parameters to pass to method. @see {@link OrionTearoffChild.messageParent} @example var args = []; args[0] = 'This is a message from the parent starlet'; OrionTearoffParent.messageChild('starlet_key', '', 'messageFromParent', args); */ /** @method OrionTearoffParent.setChildClosedCallback @desc Sets a callback to alert you that the child process has closed. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires childClosed @see {@link OrionTearoffParent.unsetChildClosedCallback} @example OrionTearoffParent.setChildClosedCallback('', 'childClosedCallback'); function childClosedCallback(event) { if (event.eventName == 'childClosed') { var starlet_key = event.key; // ... } } */ /** @method OrionTearoffParent.unsetChildClosedCallback @desc Clears the child closed callback, stopping those events from being sent. @see {@link OrionTearoffParent.setChildClosedCallback} */ /** @method OrionTearoffParent.setChildLoadedCallback @desc Sets a callback to alert you that the child process has loaded. This callback needs to be set before you create a mini-tearoff. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires childLoaded @see {@link OrionTearoffParent.unsetChildLoadedCallback} @example OrionTearoffParent.setChildLoadedCallback('', 'childLoadedCallback'); function childLoadedCallback(event) { if (event.eventName == 'childLoaded') { var starlet_key = event.key; // ... } } */ /** @method OrionTearoffParent.unsetChildLoadedCallback @desc Clears the child closed callback, stopping those events from being sent. @see {@link OrionTearoffParent.setChildLoadedCallback} */ /** @namespace OrionTearoffChild @desc Creating and managing mini-tearoffs. */ /** @method OrionTearoffChild.messageParent @desc Calls a javascript function identified by objectName and functionName in the parent Starlet of a mini-tearoff. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @arg {Array.<Object|Array|String|Number|Boolean>} arguments - Parameters to pass to method. @see {@link OrionTearoffParent.messageChild} @example var args = []; args[0] = 'This is a message from the mini-tearoff'; OrionTearoffChild.messageParent('', 'messageFromChild', args); */ /** @namespace OrionConnection @desc Collection of methods private to Connection. */ /** @method OrionConnection.xmppStatus @desc Used to update the framework of the status of the xmpp connection. @arg {String} state - State of XMPP connection. @arg {String} msg - Description of state. @deprecated since version 1.9 */ /** @method OrionConnection.openStarlets @desc Used to give the framework a list of starlets to open. @todo Only requires a subset of SQL columns, verify which are necessary. @arg {Object.<Object>} starletObject - Indexed object whose keys are Framework names of Starlets. Properties in sub-objects correspond to starlets.sql. @arg {Number} starletObject.starlet_id - Framework's id of Starlet (internal, must only ascend). @arg {String} starletObject.name - Framework name of Starlet. @arg {String} starletObject.title - Display name of Starlet. @arg {String} starletObject.type - Determines permissions/abilities and methods available to Starlet. @arg {String} starletObject.url - Location of Starlet's WebView. @arg {Number} starletObject.width - Desired width of Starlet's WebView (px). @arg {Number} starletObject.height - Desired height of Starlet's WebView (px). @arg {Number} starletObject.starlet_order - Framework's ordering of Starlet (deprecated, use 0). @see {@link OrionConnection.closeStarlet} */ /** @method OrionConnection.closeStarlet @desc Closes the starlet (and it's WebView). This does not check to see if the starlet is the visible one or not. @arg {String} starletName - Framework name of Starlet. @see {@link OrionConnection.openStarlets} */ /** @method OrionConnection.messageStarlet @desc Calls a javascript function of the Starlet specified by starletName. @arg {String} starletName - Framework name of Starlet. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @arg {Array.<Object|Array|String|Number|Boolean>} arguments - Parameters to pass to method. @see {@link OrionConnection.messageAllStarlets} @see {@link OrionConnection.bulkMessageStarlets} */ /** @method OrionConnection.messageAllStarlets @desc Calls a javascript function in all Starlets except Connection. @arg {String} starletName - Framework name of Starlet. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @arg {Array.<Object|Array|String|Number|Boolean>} arguments - Parameters to pass to method. @see {@link OrionConnection.messageStarlets} @see {@link OrionConnection.bulkMessageStarlets} */ /** @method OrionConnection.bulkMessageStarlets @desc Sends the same data to multiple Starlets. @arg {Array.<Object>} starletArray - List of addressing objects containing data to send. @see {@link OrionConnection.messageStarlets} @see {@link OrionConnection.messageAllStarlets} @example var starletArray = [ { 'starlets': [ { 'starletName' : 'some_starlet', 'objectName' : 'window', 'functionName': 'callback_800' }, // ... ], 'data': [], // arguments }, // ... ]; OrionConnection.bulkMessageStarlets(starletArray); */ /** @method OrionConnection.reloadStarlet @desc Reloads the Starlet specified by starletName. @arg {String} starletName - Framework name of Starlet. @arg {Boolean} ignoreCache - Whether to fetch from server when reloading. @see {@link OrionConnection.reloadStarletWithURL} @see {@link OrionConnection.reloadAllStarlets} */ /** @method OrionConnection.reloadStarletWithURL @desc Reloads the Starlet specified by starletName. @arg {String} starletName - Framework name of Starlet. @arg {String} url - New location to load in Starlet's WebView. @see {@link OrionConnection.reloadStarlet} @see {@link OrionConnection.reloadAllStarlets} */ /** @method OrionConnection.reloadAllStarlets @desc Reloads all Starlets except Connection. @see {@link OrionConnection.reloadStarlet} @see {@link OrionConnection.reloadStarletWithURL} */ /** @method OrionConnection.showWindow @desc Shows a window that a starlet is in that has been hidden. @arg {String} starletName - Framework name of Starlet. @see {@link OrionConnection.hideWindow} @see {@link OrionStarletWindow.show} @see {@link OrionStarletWindow.hide} */ /** @method OrionConnection.hideWindow @desc Hides the window the starlet is in. @arg {String} starletName - Framework name of Starlet. @see {@link OrionConnection.showWindow} @see {@link OrionStarletWindow.show} @see {@link OrionStarletWindow.hide} */ /** @method OrionConnection.resizeWindow @desc Resizes the webview the starlet is in. @arg {String} starletName - Framework name of Starlet. @arg {Number} width - Desired width of WebView (px). @arg {Number} height - Desired height of WebView (px). @see {@link OrionStarletWindow.resize} */ /** @method OrionConnection.activateWindow @desc Unhides, unminimizes, and brings to the front the window the Starlet is in. @arg {String} starletName - Framework name of Starlet. @see {@link OrionStarletWindow.activate} */ /** @method OrionConnection.loadURL @desc Loads a URL in the Starlet. @arg {String} starletName - Framework name of Starlet. @arg {String} url - Location to navigate to. @see {@link OrionConnection.reloadStarletWithURL} @see {@link OrionConnection.loadHTML} */ /** @method OrionConnection.loadHTML @desc Loads HTML content in the Starlet. @todo Determine if HTML needs to be escaped in any way. @arg {String} starletName - Framework name of Starlet. @arg {String} html - Content to replace with. @see {@link OrionConnection.reloadStarletWithURL} @see {@link OrionConnection.loadURL} @example OrionConnection.loadHTML('navigation' ,"<html><head><title>Test</title></head><body>Navigation!</body></html>"); */ /** @method OrionConnection.logoffApplication @desc Log off and return to the splash screen. @see {@link OrionConnection.logoffApplicationWithMessage} @see {@link OrionConnection.closeFramework} */ /** @method OrionConnection.logoffApplicationWithMessage @desc Log off and return to the splash screen while displaying a message. @see {@link OrionConnection.logoffApplication} @see {@link OrionConnection.closeFramework} */ /** @method OrionConnection.setAnimationStepCallback @desc Sets a callback to alert you that there is an animation in progress, and give you the pixel values for this frame of animation. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires animationStep @see {@link OrionConnection.unsetAnimationStepCallback} @example OrionConnection.setAnimationStepCallback('', 'animationCallback'); function animationCallback(event) { if (event.eventName == 'animationStep') { var x = event.x, y = event.y; // ... } } */ /** @method OrionConnection.unsetAnimationStepCallback @desc Clears the animation step callback, stopping those events from being sent. @see {@link OrionConnection.setAnimationStepCallback} */ /** @method OrionConnection.closeFramework @desc Closes the framework. @arg {Boolean} restart - Whether to reopen the Framework after closing. @arg {Boolean} clearCache - Whether to clear Browser cache before closing, useful for upgrades. @see {@link OrionConnection.logoffApplication} @see {@link OrionConnection.logoffApplicationWithMessage} */ /** @method OrionConnection.setKeyboardShortcut @desc Sets a global keyboard shortcut. When the shortcut is used, it will call your callback. @arg {Number} keyCode - Raw JavaScript keyCode. @arg {Number} modifiers - ORed together modifier values. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @see {@link OrionConnection.setKeyboardShortcut(2)} @see {@link keyboardCallback} @see {@link M_ALT} @see {@link M_CONTROL} @see {@link M_COMMAND} @see {@link M_SHIFT} @see {@link KEYCODES} @example var modifiers = 0; modifiers |= 1; // adding in ALT modifiers |= 8; // adding in SHIFT // modifiers is now ALT + SHIFT. OrionConnection.setKeyboardShortcut(keyCode, modifiers, '', 'keyboardCallback'); function keyboardCallback(eventType, repeat) { // eventType 0 - keyDown // eventType 1 - keyDown // eventType 2 - keyUp // eventType 3 - keyChar // if repeat = true it's a repeat keypress (due to being held down) KEYDOWN EVENTS ONLY // the shortcut you set was used } */ /** @method OrionConnection.setKeyboardShortcut(2) @desc Called with a blank objectName and callbackName to unset the callback. @arg {Number} keyCode - Raw JavaScript keyCode. @arg {Number} modifiers - ORed together modifier values. @arg {String} objectName - '' @arg {String} callbackName - '' @see {@link OrionConnection.setKeyboardShortcut} @see {@link M_ALT} @see {@link M_CONTROL} @see {@link M_COMMAND} @see {@link M_SHIFT} @see {@link KEYCODES} @example var modifiers = 0; modifiers |= 1; // adding in ALT modifiers |= 8; // adding in SHIFT // modifiers is now ALT + SHIFT. OrionConnection.setKeyboardShortcut(keyCode, modifiers, '', ''); */ /** @method OrionConnection.getLocalStarlets @desc Gets a list of local starlets listed in starlets.sql (if there are any to get). @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires localStarlets @example OrionConnection.getLocalStarlets('', 'localStarletCallback'); function localStarletCallback(starletObject) { // ... } */ /** @method OrionConnection.setLinkCallback @desc Sets a callback to alert you that an ORIONAPP link was pressed. It will pass along a string of the "url" to your callback function. Note that if the framework was started via an ORIONAPP link, the framework will call this callback as soon as it's registered. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires orionappUrl @see {@link OrionConnection.unsetLinkCallback} @example OrionConnection.setLinkCallback('', 'linkCallback'); function linkCallback(data) { // URL in the format 'orionapp://hello?foo=bar&bar=spam' } */ /** @method OrionConnection.unsetLinkCallback @desc Clears the link callback, stopping those events from being sent. @see {@link OrionConnection.setLinkCallback} */ /** @method OrionConnection.setFrameworkSettings @desc Sets framework specific settings that must be stored locally. @arg {Object.<Boolean>} data - Key/value pairs to save. @arg {Boolean} data.start - Whether the Framework should start on logging into the OS. @arg {Boolean} data.minimize - When start is true, whether framework should start minimized. @see {@link OrionConnection.getFrameworkSettings} @example OrionConnection.setLinkCallback('', 'linkCallback'); function linkCallback(data) { // URL in the format 'orionapp://hello?foo=bar&bar=spam' } */ /** @method OrionConnection.getFrameworkSettings @desc Asks the framework to return the current framework settings for start on login and start minimized. The callback will return an object identical to that described in setFrameworkSettings. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires frameworkSettings @see {@link OrionConnection.setFrameworkSettings} @example OrionConnection.getFrameworkSettings('', 'settingsCallback'); function settingsCallback(data) { var startOnLogin = data.start, startMinimized = data.minimize; // ... } */ /** @method OrionConnection.setCrashCallback @desc Sets a callback to alert you that a starlet has been terminated unexpectedly. It will pass along the starlet name and a status code. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @see {@link OrionConnection.unsetCrashCallback} @see {@link crashCallback} @example OrionConnection.setCrashCallback('', 'crashCallback'); function crashCallback(starletName, status) { // ... } */ /** @method OrionConnection.unsetCrashCallback @desc Clears the crash callback, stopping those events from being sent. @see {@link OrionConnection.setCrashCallback} */ /** @method OrionConnection.focusStarlet @desc Controls keyboard focus of a named Starlet . @arg {String} starletName - Framework name of Starlet. @arg {Boolean} focus - Whether the Starlet should gain or lose keyboard focus. @example OrionConnection.focusStarlet('orion_app_messages', true); */ /** @method OrionConnection.setStarletAPIKey @desc Tells the framework the starlet API key and password. @arg {String} key - New API key. @arg {String} password - New API password. @example OrionConnection.setStarletAPIKey('new_key', 'new_password'); */ /** @method OrionConnection.setUserPassword @desc Sets the framework saved password to passwordHash, if changed in settings. @arg {String} passwordHash - Hash of new password. @example OrionConnection.setUserPassword('57392Efksjei291'); */ /** @namespace OrionShoebox @desc Functions used by the shoebox Starlet. */ /** @method OrionShoebox.stateChanged @desc Tells the Framework shoebox has opened or closed. Used internally for input focus. @arg {Boolean} opened - Whether shoebox is open. */ /** @method OrionShoebox.offsetWindow @desc Move shoebox to the left (-offset) or the right (+offset) to animate opening and closing. The framework will make sure you don't over or underflow it's positioning. @arg {Number} offset - X offset of shoebox overlay relative to main application window */ /** @namespace OrionNavigation @desc Functions used by the navigation Starlet. */ /** @method OrionNavigation.stateChanged @desc Tells the Framework navigation has opened or closed. Used internally for input focus. @arg {Boolean} opened - Whether navigation is open. */ /** @method OrionNavigation.makeStarletVisible @desc Animates a transition to specified Starlet. @arg {String} starletName - Framework name of Starlet to switch to. @arg {Boolean} focusNew - Whether the Starlet being switched to should take input focus after animation is complete. @arg {Number} duration - How long the anomation should last (sec, float). @arg {String} direction - 'left', 'right', 'up', 'down', or 'none'. @arg {Array.<Number>} easingData - List of float tween values between 0 and 1 corresponing to each step of the animation. @example var data = [ 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 ]; OrionNavigation.makeStarletVisible('name_of_starlet', true, 2.5, 'right', data); */ /** @method OrionNavigation.startAnimation @desc Tells the framework to prepare for a starlet switch animation. @arg {String} starletName - Framework name of Starlet to switch to. @arg {Boolean} focusNew - Whether the Starlet being switched to should take input focus after animation is complete. @arg {String} direction - 'left', 'right', 'up', 'down', or 'none'. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires animationReady @example OrionNavigation.startAnimation('name_of_starlet', true, 'up', '','animationReady'); animationReady(ready) { // If ready is false, there was an initialization problem. Do not continue with animation. } */ /** @method OrionNavigation.animationStep @desc Tells the framework to process one step of animation. {@link OrionNavigation.startAnimation} must be called first. @arg {Number} tween - A float (must force) from 0 to 1 indicating a percentage of distance. @example OrionNavigation.stepAnimation(0.5); // The framework will position the relevant WebViews 50% across the main application window. */ /** @method OrionNavigation.stopAnimation @desc Tells the framework to complete the animation cycle. If callback is defined, the framework will call it to let the starlet know everything has completed. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @example OrionNavigation.stopAnimation('', 'animationComplete'); animationComplete() { // ... } */ /** @method OrionNavigation.getVisibleStarlet @desc Returns the name of the currently visible starlet in the main framework window to the callback specified. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires visibleStarlet @see {@link OrionNavigation.setVisibleStarletCallback} @example OrionNavigation.getVisibleStarlet('', 'visibleStarletCallback'); function visibleStarletCallback(starletName) { // starletName is the visible starlet } */ /** @method OrionNavigation.setVisibleStarletCallback @desc Sets a callback to be called when the starlet in the main framework window changes (due to navigation). @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires visibleStarlet @see {@link OrionNavigation.getVisibleStarlet} @example OrionNavigation.setVisibleStarletCallback('', 'visibleStarletCallback'); function visibleStarletCallback(starletName) { // starletName is the new visible starlet } */ /** @method OrionNavigation.unsetVisibleStarletCallback @desc Clears the visible starlet callback, stopping those events from being sent. (due to navigation). @see {@link OrionNavigation.setVisibleStarletCallback} */ /** @method OrionNavigation.setAnimateStarletCallback @desc This lets the framework know which function to call in order to navigate to a Starlet. Used when someone hits the navigate hotkey. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @see {@link animateStarletCallback} @see {@link OrionNavigation.unsetAnimateStarletCallback} @example OrionNavigation.setAnimateStarletCallback('', 'animateStarletCallback'); function animateStartletCallback(starletName, direction) { // starletName is the starlet we want to animate to // if starletName == 'next', choose the next starlet on your list. // if starletName == 'prev', choose the previos starlet on your list. // direction is 'up', 'down' , 'left', 'right' or 'none'. } */ /** @method OrionNavigation.unsetAnimateStarletCallback @desc Clears the animate starlet callback, stopping those events from being sent. @see {@link OrionNavigation.setAnimateStarletCallback} */ /** @method OrionNavigation.offsetWindow @desc Move Navigation's WebView to the left/right (+/-offset) to animate opening and closing. The framework will make sure you don't over or underflow it's positioning. (Only available via callFunction method or reexposed methods.) @arg {Number} offset - Distance from lateral edge of this WebView to edge of main application window (px). @see {@link OrionStarletWindow.resize} @example OrionNavigation.callFunction('offsetWindow', [-25]); // or OrionNavigation.offsetWindow(-25); */ /** @namespace OrionAPI @desc Functions used by starlets to use the API. */ /** @method OrionAPI.getURL @desc Returns the fully hashed API URL to your callback for you to use. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @arg {String} baseURL - Remote path to API method of choice. @arg {Object} parameters - Index of variables to include in query string. @fires apiURL @example var params = {}; params.foo = 'bar'; params.spam = false; OrionAPI.getURL('', 'apiURLCallback', '/api-v4/some_api_call', params); function apiURLCallback(url) { // url contains the fully hashed API URL ready to call. } */ /** @namespace OrionLightbox @desc Gives Starlets the ability to open lightboxes. */ /** @method OrionLightbox.open @desc Opens a lightbox called starletName using the criteria provided. The lightbox will appear and remain centered in the main application window. You are responsible for resizing the lightbox if desired. @arg {String} starletName - Desired Framework name of new Starlet. @arg {String} url - Location to load in lightbox. @arg {Number} width - Desired width of lightbox (px). @arg {Number} height - Desired height of lightbox (px). @see {@link OrionLightbox.close} @see {@link OrionLightbox.closeSelf} @see {@link OrionStarletWindow.resize} */ /** @method OrionLightbox.close @desc Closes the lightbox called starletName. @arg {String} starletName - Framework name of Starlet in lightbox. @see {@link OrionLightbox.closeSelf} @see {@link OrionLightbox.open} */ /** @method OrionLightbox.closeSelf @desc Call from within a lightbox to close itself, regardless of Starlet name. @see {@link OrionLightbox.close} @see {@link OrionLightbox.open} */ /** @method OrionLightbox.setClosedCallback @desc Sets a callback to alert you when a lightbox has closed. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires lightboxClosed @see {@link OrionNavigation.unsetClosedCallback} @see {@link OrionLightbox.close} @see {@link OrionLightbox.closeSelf} @example OrionLightbox.setClosedCallback('', 'closedCallback'); function closedCallback(event) { if (event.eventName == 'lightboxClosed') { var lightboxName = event.name; // ... } } */ /** @method OrionNavigation.unsetClosedCallback @desc Clears the lightbox closed callback, stopping those events from being sent. @see {@link OrionNavigation.setClosedCallback} */ /** @namespace OrionNotification @desc Collection of methods private to Notification Starlet. */ /** @method OrionNotification.setLocation @desc Tells the framework where on the screen to display Notification. @arg {String} location - 'topleft' | 'topright' | 'bottomleft' | 'bottomright' @arg {String} callbackName - Name of method. @see {@link OrionStarletWindow.show} @see {@link OrionStarletWindow.hide} */ /** @namespace OrionUpdate @desc Collection of methods for dealing with Framework updates. */ /** @method OrionUpdate.setProgressCallback @desc Sets a callback to get progress for a framework update download. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires updateProgressEvent @see {@link OrionUpdate.unsetProgressCallback} @example OrionUpdate.setProgressCallback('', 'progressCallback'); function progressCallback(event) { if (event.eventName == 'updateProgressEvent') { var currentBytes = event.current, totalBytes = event.total; // ... } } */ /** @method OrionUpdate.unsetProgressCallback @desc Clears the update download progress callback, stopping those events from being sent. @see {@link OrionUpdate.setProgressCallback} */ /** @method OrionUpdate.setErrorCallback @desc Sets a callback to get progress for a framework update download. @arg {String} [objectName='window'] - Namespace containing method. @arg {String} callbackName - Name of method. @fires updateErrorEvent @see {@link OrionUpdate.unsetErrorCallback} @example OrionUpdate.setErrorCallback('', 'errorCallback'); function errorCallback(event) { if (event.eventName == 'updateErrorEvent') { var code = event.errorCode; // ... } } */ /** @method OrionUpdate.unsetErrorCallback @desc Clears the update error callback, stopping those events from being sent. @see {@link OrionUpdate.setErrorCallback} */ /** @method OrionUpdate.startUpdate @desc Starts a update check/download. If an update is found, it will begin downloading the update. @arg {String} targetVersion - Representation of the framework version we are updating to. e.g "2.1.2". @arg {String} url - Location to look for the XML file on Mac, or the serverside script on Windows. Pass in a blank string to use the default value. @see {@link OrionUpdate.cancelUpdate} @example OrionUpdate.startUpdate('3.4.1', ''); */ /** @method OrionUpdate.cancelUpdate @desc Clears the update error callback, stopping those events from being sent. @see {@link OrionUpdate.setErrorCallback} */ /** @namespace OrionFileSystem @desc Collection of methods for managing local files. */ /** @method OrionFileSystem.createDirectory @desc Creates a new directory if it doesn't already exist. @arg {String} basePath - Directory to add to. Can end with a path separator, or not. You can only create one new directory at a time, it will not recursively create them. @arg {String} newDirectory - Name of the new directory. */ /** @method OrionFileSystem.deleteFile @desc Deletes a file if it exists. @arg {String} path - Full path of the file. */ // /* re-expose framework methods */ // (function () // { // var pattern = /^Orion/; // for (var key in window) { if (pattern.test(key) && key !== 'OrionObjects') // { // //var obj = $.extend(true, {}, window[key]); // //console.log(key, obj); // window[key] = (function () // { // var obj = $.extend(true, {}, window[key]), // func = function () // { // var args = [].slice.call(arguments), // method = args.shift(); // console.log(key, obj, window[key]); // return obj.callFunction.apply(obj, [method, args]); // }; // func = $.extend(true, func, obj); // console.log('+', key, func); // return func; // } // )(); // }} // } // )(); // (function () // { // var pattern = /^Orion/, // methods = []; // for (var obj in window) // { // pattern.test(obj) // && obj !== 'OrionObjects' // && [].push.apply // ( // methods, // Object // .getOwnPropertyNames(window[obj]) // .filter(function (method) // { // return method !== 'callFunction' // && window[obj][method].constructor === Function; // }) // .map(function (method) { return obj + '.' + method; }) // ); // } // console.log(methods); // var objs = {}; // for (var i = 0; i < methods.length; i++) // { // var temp = methods[i].split('.'), // a = temp[0], // b = temp[1]; // !objs[a] && (objs[a] = []); // objs[a].push(b); // } // console.log(objs); // } // )(); // var methods = // [ // 'OrionAPI.getURL', // 'OrionAPI.getFrameworkURL', // 'OrionSystem.logToConsole', // 'OrionSystem.getSystemIdleTime', // 'OrionSystem.getFlashVersion', // 'OrionSystem.openExternalURL', // 'OrionSystem.executeMailTo', // 'OrionSystem.showOpenFileDialog', // 'OrionSystem.showSaveFileDialog', // 'OrionSystem.showDirectoryDialog', // 'OrionSystem.saveTextDataToFile', // 'OrionSystem.saveBinaryDataToFile', // 'OrionSystem.copyToClipboard', // 'OrionSystem.showPDF', // 'OrionSystem.launchExternalProgram', // 'OrionSystem.setSleepCallback', // 'OrionSystem.unsetSleepCallback', // 'OrionSystem.setWakeCallback', // 'OrionSystem.unsetWakeCallback', // 'OrionSystem.generateUniqueKey', // 'OrionSystem.doesCameraExist', // 'OrionSystem.doesMicrophoneExist', // 'OrionSystem.showDevTools', // 'OrionSystem.showPrintDialog', // 'OrionSystem.createLogBundle', // 'OrionSystem.setDragCallback', // 'OrionSystem.unsetDragCallback', // 'OrionSystem.setKeyboardShortcut', // 'OrionStarletWindow.activate', // 'OrionStarletWindow.show', // 'OrionStarletWindow.hide', // 'OrionStarletWindow.resize', // 'OrionStarletWindow.setMinimizeCallback', // 'OrionStarletWindow.unsetMinimizeCallback', // 'OrionStarletWindow.setFocusCallback', // 'OrionStarletWindow.unsetFocusCallback', // 'OrionStarletWindow.setHiddenCallback', // 'OrionStarletWindow.unsetHiddenCallback', // 'OrionStarletWindow.setMouseCallback', // 'OrionStarletWindow.unsetMouseCallback', // 'OrionStarletWindow.loadURL', // 'OrionStarletWindow.loadHTML', // 'OrionStarletWindow.setStarletVisibleCallback', // 'OrionStarletWindow.unsetStarletVisibleCallback', // 'OrionStarletWindow.setFocus', // 'OrionShoebox.stateChanged', // 'OrionTearoff.create', // 'OrionTearoff.remove', // 'OrionTearoffParent.createTearoffChildFromURL', // 'OrionTearoffParent.createHiddenTearoffChildFromURL', // 'OrionTearoffParent.destroyTearoffChild', // 'OrionTearoffParent.messageChild', // 'OrionTearoffParent.setChildClosedCallback', // 'OrionTearoffParent.unsetChildClosedCallback', // 'OrionTearoffParent.setChildLoadedCallback', // 'OrionTearoffParent.unsetChildLoadedCallback', // 'OrionTearoffChild.messageParent', // 'OrionLightbox.setClosedCallback', // 'OrionLightbox.unsetClosedCallback', // 'OrionLightbox.open', // 'OrionLightbox.close', // 'OrionLightbox.closeSelf', // 'OrionObjectStore.getObject', // 'OrionObjectStore.setObject', // 'OrionCommunication.messageConnection', // 'OrionSimpleSoundPlayer.playSound', // 'OrionDownload.downloadFile', // 'OrionDownload.stopDownload', // 'OrionDownload.setProgressCallback', // 'OrionDownload.unsetProgressCallback', // 'OrionDownload.setFinishCallback', // 'OrionDownload.unsetFinishCallback', // 'OrionDownload.setErrorCallback', // 'OrionDownload.unsetErrorCallback', // 'OrionDownload.setResponseCallback', // 'OrionDownload.unsetResponseCallback', // 'OrionUpload.uploadFile', // 'OrionUpload.uploadFileToAPI', // 'OrionUpload.stopUpload', // 'OrionUpload.setProgressCallback', // 'OrionUpload.unsetProgressCallback', // 'OrionUpload.setFinishCallback', // 'OrionUpload.unsetFinishCallback', // 'OrionUpload.setErrorCallback', // 'OrionUpload.unsetErrorCallback', // 'OrionUpload.setResponseCallback', // 'OrionUpload.unsetResponseCallback', // 'OrionBC.validateUser', // 'OrionBC.connectUser', // 'OrionBC.initializeSync', // 'OrionBC.doLogout', // 'OrionBC.setErrorCallback', // 'OrionBC.unsetErrorCallback', // 'OrionBC.setResultCallback', // 'OrionBC.unsetResultCallback', // 'OrionFramework.unsetResizeCallback', // 'OrionFramework.setResizeCallback', // 'OrionFramework.getLegacyNotificationSettings', // 'OrionUpdate.setProgressCallback', // 'OrionUpdate.unsetProgressCallback', // 'OrionUpdate.setErrorCallback', // 'OrionUpdate.unsetErrorCallback', // 'OrionUpdate.startUpdate', // 'OrionUpdate.cancelUpdate', // 'OrionFileSystem.createDirectory', // 'OrionFileSystem.deleteFile' // ];