The Fusion object contains these methods:
- registerForEvent( event_id, callback ) – used to register a callback function for events emitted by Fusion itself. Most events are actually emitted by components, and you will need to register with those components specifically if you want to receive their events.
- deregisterForEvent( event_id, callback ) – used to remove a callback associated with an event. This can only be called if the callback has already been registered via registerForEvent. The callback must be the same function pointer that was passed to registerForEvent. If you are using the bind() method to bind a function to an object instance, you should save a reference to the result of calling bind() and use that for calling registerForEvent if you plan to later call deregisterForEvent.
- initializeLocale( optional_locale ) – should be called at the beginning of the window.onloadi function if String.Translate is going to be used.
- ajaxRequest( scriptUrl, options ) – a helper function for calling server-side scripts using XmlHttpRequest by modifying the scriptUrl to use the redirect script if necessary. This is primarily used by components that need to call a server-side script to perform some action so that they are portable across a variety of uses. Custom JavaScript using the Fusion API generally should not need to use this function. The options are passed through to prototype's Ajax.Request and must conform to the specifications for Ajax.Request.
- getMapById( id ) – returns a reference to a Map component by the ID of the element the map was created in. If no map was created in an element with this ID, it returns null.
- getMapByName( name ) – returns a reference to a Map component by the name of the Map. If no map component has a map of the requested name, it returns null.
- getMapByIndice( index ) – returns the map at the requested index. (The index is zero-based.) A Map's index depends on its position in the Web Layout file relative to other maps.
- getWidgetById( id ) – returns a reference to a component by the ID of the element the component was created in. If no component was created in an element with this ID, it returns null.
- getWidgetsByType( type ) – returns an array with references to all the components of the given type. If no components of a given type are found, an empty array is returned.
- getConfigurationItem( arch, key ) – returns a Fusion configuration value for the given architecture and key.
- getScriptLanguage() – returns the server-side scripting language for the application, for example “PHP”. Flexible web layouts are designed to support multiple server-side scripting languages. All communication with server-side scripts should use the getScriptLanguage function to ensure compatibility with future versions.
- error( code, message ) – triggers an error. Applications can register for the FUSION_ERROR event to be informed of errors that occur.
The following methods work with units of measurement. For more information, see Units.
- unitFromName( name ) – returns the numeric code for a unit of measurement from its name. Most functions that deal with measurements use the numeric code.
- unitName( code ) – returns the name of a unit of measurement from a numeric code.
- unitAbbr( code ) – returns the abbreviation of a unit of measure from a numeric code.
- toMeter( code, amount ) – converts a measurement into meters from the given numeric code.
- fromMeter( code, amount ) – converts a measurement from meters into the units represented by the numeric code.
- convert( fromCode, toCode, amount ) – converts a measurement from one unit of measurement into another.