### Hello World Map Example (Browser) Source: https://github.com/supermap/iclient-javascript/blob/master/src/classic/resource/Android/help/examples.html This is a basic browser-based map example that serves as a starting point. It initializes a map with standard controls and adds a CloudLayer. ```html SuperMap iClient for JavaScript
``` -------------------------------- ### Complete Portal Integration Example Source: https://github.com/supermap/iclient-javascript/blob/master/_autodocs/api-reference/portal-services.md Demonstrates a full portal integration workflow, including getting user info, searching resources, and sharing a resource. Ensure you have imported necessary modules like IPortal, ResourceType, and PermissionType. ```javascript import { IPortal, ResourceType, PermissionType } from '@supermapgis/iclient-common'; const iportal = new IPortal('http://iportal.example.com'); // Get current user const userService = new IPortalUser(iportal.url); userService.getUserInfo().then(user => { console.log('Logged in as:', user.username); }); // Search for resources const resourceService = new IPortalResource(iportal.url); resourceService.searchResources({ keyword: 'world', resourceType: ResourceType.MAP }).then(result => { console.log('Found maps:', result.resources); }); // Share a resource const shareParams = { resourceId: 'map123', shareEntity: [{ type: 'USER', id: 'admin', name: 'admin' }], permissionType: PermissionType.READ }; iportal.shareResource(shareParams); ``` -------------------------------- ### Load Example Template and Scripts Source: https://github.com/supermap/iclient-javascript/blob/master/examples/mapboxgl/examples.html This snippet demonstrates how to load an example template and dynamically append script tags for various mapping libraries and utility scripts. It's useful for setting up a base environment for interactive map examples. ```javascript $('.wrapper').load("../template/example.html", function () { var navigation = { nav: { title: "2025", path: "../../web/", isLocal: window.isLocal } }; utils.loadTemplate(".icl-header", "../template/header.html", navigation); $body = $('body'); $body.append("