Dynamics Mobile Studio allows the developers to use third-party javascript libraries.
The developer can obtain such library and upload it into Dynamics Mobile Studio.
It can be used then in the modules. It is the developer responsibility to make sure that the library can run on the target mobile devices.
The libraries can be accessed via the Dynamics Mobile Studio Libraries link on the left.
It displays the list of the available libraries in the system.
Note that the libraries are shared across all Dynamics Mobile Studio modules in the application area. It means that if you change or update a library it will affect the rest of the existing modules in the current application area.
The list of the libraries displays the following columns:
- Name – Unique internal identifier of the library
- Title – Descriptive title of the library
- Is Global – Shows if the library is global. The global libraries are automatically “included” and can be used in all tasks without additional work. Non-global libraries must be explicitly used in the tasks by using the Task properties window
Note that you will always need the JSCORE, which contains the core cross-platform mobile implementation. It is used by the web-browser client. The device-native core (Android, etc. ) includes own version of the JSCORE library.
It means that if you update/change the JSCORE library, it will only affect the users accessing the functionality via web browser.
The developer can perform the following:
- Creating a new library by clicking the New Library button on the top
- Opening existing library for modification by clicking over the Name of the library
- Deleting existing library by checking the checkbox next to the library and clicking the Delete button
- Displaying the library properties by clicking the [i] icon next to the library
- Importing new library from the PC by clicking the Import button on top
Creating new library
The developer can click the New Library button to create a new library. The system will require the developer to enter the internal Name of the library, the Title and the Is-Global status. The developer can then open the empty library by clicking over the library’s name. It will navigate to the library editor.
The Library editor will display the list of the resources included in the library. The list displays only the name of the resource together with the file extension. The library editor recognizes the following resource type:
- javascript files ( .js )
- cascading style sheet files (.css)
- image files ( png,jpg,gif,ico,bmp)
The developer is free to upload any other resource, but only the upper mentioned will be delivered to the target device with the appropriate MIME type.
Each resource has a order ,which defines the order in which the resource is delivered to the devices. It is very important for the javascript files to be delivered in the right order required by the library. The resources are displayed in the order, which will be actually used when delivering them to the device.
The developer can perform the following:
- Upload new resource by clicking the Add resource button on top
- Re-name or update existing resource by clicking the [pencil] icon next to the resource
- Deleting existing resource by clicking the [X] icon next to the resource
- Changing the delivery order of the resource by cusing the [up] and [down] arrows next to the resource
- Exporting the library by clicking the Export button on top
- Renaming the library or changing the Global status by clicking the [pencil] button on top to open the properties window
Uploading a new resource within the library
The developer can use the New resource button to upload a new resource within the library like javascript ,css file or image file. It is important to order the resources in the right order required by the library.
Exporting a library
The developer can click the Export button on top to export the library and download it locally. The export is actually a ZIP archive containing the library resources. It can be imported then in another application area.
Importing a library
The developer can import a library into the application area by clicking the Import button on top. It will open upload page where the developer has to select a library archive from the PC. Note that only libraries exported from another application area can be imported.
Using libraries in your code
The purpose of the libraries support in Dynamics Mobile Studio is to allow the developer to quickly re-use existing code. There are tons of free and commercial libraries in the wild, so this feature significantly increases the productivity of the developer.
There two libraries types in terms of usage:
- Global
- Non-global
The actual type of the library is defined by the developer when creating the library or later from the library properties window. The Global vs Non-Global library type actually allows the developer to optimize the code size hence the loading performance for each task.
Global libraries
The global libraries are “included” in all tasks, so it means that when the user starts a task on the device it will automatically preload all GLOBAL libraries. It is not recommended to have other Global libraries then the JSCORE due to performance reasons.
Non-global libraries
The non-global libraries on the other side are only “included” in tasks, where the developer opted,so.
Check-out the Working with Tasks section for more details