In this section, we present the client-side Slice-to-JavaScript mapping. The client-side Slice-to-JavaScript mapping defines how Slice data types are translated to JavaScript types, and how clients invoke operations, pass parameters, and handle errors. Much of the JavaScript mapping is intuitive. For example, Slice sequences map to JavaScript arrays, so there is essentially nothing new you have to learn in order to use Slice sequences in JavaScript.
Much of what appears in this chapter is reference material. We suggest that you skim the material on the initial reading and refer back to specific sections as needed. However, we recommend that you read at least the mappings for exceptions, interfaces, and operations in detail because these sections cover how to call operations from a client, pass parameters, and handle exceptions.
In order to use the JavaScript mapping, you should need no more than the Slice definition of your application and knowledge of the JavaScript mapping rules. In particular, looking through the generated code in order to discern how to use the JavaScript mapping is likely to be inefficient, due to the amount of detail. Of course, occasionally, you may want to refer to the generated code to confirm a detail of the mapping, but we recommend that you otherwise use the material presented here to see how to write your client-side code.
The Ice
Scope
All of the APIs for the Ice run time are nested in the Ice
scope, to avoid clashes with definitions for other libraries or applications. Some of the contents of the Ice
scope are generated from Slice definitions; other parts of the Ice
scope provide special-purpose definitions that do not have a corresponding Slice definition. We will incrementally cover the contents of the Ice
scope throughout the remainder of the manual.
Topics
- JavaScript Mapping for Identifiers
- JavaScript Mapping for Modules
- JavaScript Mapping for Built-In Types
- JavaScript Mapping for Enumerations
- JavaScript Mapping for Structures
- JavaScript Mapping for Sequences
- JavaScript Mapping for Dictionaries
- JavaScript Mapping for Constants
- JavaScript Mapping for Exceptions
- JavaScript Mapping for Interfaces
- JavaScript Mapping for Operations
- JavaScript Mapping for Classes
- slice2js Command-Line Options