Home - TheEditorX/wme-sdk-plus GitHub Wiki

WME SDK Plus

WME SDK Plus is an extension to the native Waze Map Editor (WME) SDK, providing additional functionality and convenience methods for script writers. It allows you to build more powerful and feature-rich scripts for WME.

Introduction

This library extends the WME SDK with a system of "modules," each adding a specific set of related features. This allows script writers to selectively enable only the functionality they need.

Installation & Initialization

To use WME SDK Plus, you first need to import the library. We recommend using jsDelivr as it allows version binding. Our library follows the Semantic Versioning specification, which means we only update the major if we introduce a breaking change that might require your attention, the minor on backward-compatible releases, and the patch when we release an unplanned fix (normally, fixes are delivered as a minor version bump, but for crucial bugs, we might want to release them earlier. We highly advise you to bind the major version as it would allow us to release fixes and new versions regularly without accidentally breaking your script due to an incompatible update.

If you're listing your script on Greasyfork, use this URL to import the library:

  • https://cdn.jsdelivr.net/gh/TheEditorX/wme-sdk-plus@{commit-hash}/wme-sdk-plus.js. Copy the commit hash of the desired version from here. As Greasyfork requires specific commit hashes to be used, you'll be required to manually update the URL when a new version of SDK+ is released, otherwise you won't get any updates at all. This is because per Greasyfork's policy, externals cannot be modified after they're made public.

If you don't use Greasyfork, you can use any of the following URLs to import the library:

  • https://cdn.jsdelivr.net/gh/TheEditorX/wme-sdk-plus@latest/wme-sdk-plus.js - The most recent version. No version bindings.
  • https://cdn.jsdelivr.net/gh/TheEditorX/wme-sdk-plus@{major}/wme-sdk-plus.js - Binds the library version to the major. Replace the {major} with the actual major version you request.
  • https://cdn.jsdelivr.net/gh/TheEditorX/wme-sdk-plus@{major}.{minor}/wme-sdk-plus.js - Binds the library version to the major + minor. Replace {major} and {minor} with the actual major and minor versions you request.
  • https://cdn.jsdelivr.net/gh/TheEditorX/wme-sdk-plus@{major}.{minor}.{patch}/wme-sdk-plus.js - Binds the library version to the major + minor. Replace {major}, {minor}, and {patch} with the actual major, minor, and patch versions you request.

You can find the most recent (and previous) versions here.

To import the library, add a @require header to your script. For example, add // @require https://cdn.jsdelivr.net/gh/TheEditorX/wme-sdk-plus@latest/wme-sdk-plus.js to import the latest version.

Once imported, obtain the native WME SDK instance and initialize WME SDK Plus using the initWmeSdkPlus function.

async function initialize() {
  const wmeSdk = await getWmeSdk(); // Assuming getWmeSdk is your method to get the native SDK.
  const sdkPlus = await initWmeSdkPlus(wmeSdk, {
    // Optional: Enable only specific modules (see below for patch paths)
    // hooks: ['Editing.Transactions', 'DataModel.MapComments'],

    // Optional: Get a new, immutable SDK instance (default is to modify the original)
    // immutable: true
  });

  // If immutable is false (default), wmeSdk is now enhanced.
  // If immutable is true, sdkPlus is the enhanced SDK, and wmeSdk is unchanged.
  const sdk = sdkPlus || wmeSdk;

  // Now you can use the extended SDK methods:
  // sdk.Editing.doActions(...);
  // sdk.DataModel.MapComments.addMapComment(...);
  // ... etc.
}

initialize();