Versioned grid API and capabilities
experimental
Inspect the API version and register optional capabilities.
Live example
Expected behavior
A capability stays available while a provider is registered. Calling undo without a history provider gives an install hint.
Source
console.log(api.version, api.getCapabilities());
const release = api.provideCapability({ capability: 'history', undo: undoLastCommand });
if (api.hasCapability('history')) api.undo();
release();console.log(api.version, api.getCapabilities());
const release = api.provideCapability({ capability: 'history', undo: undoLastCommand });
if (api.hasCapability('history')) api.undo();
release();console.log(api.version, api.getCapabilities());
const release = api.provideCapability({ capability: 'history', undo: undoLastCommand });
if (api.hasCapability('history')) api.undo();
release();console.log(api.version, api.getCapabilities());
const release = api.provideCapability({ capability: 'history', undo: undoLastCommand });
if (api.hasCapability('history')) api.undo();
release();// JavaScript interop module
console.log(api.version, api.getCapabilities());
const release = api.provideCapability({ capability: 'history', undo: undoLastCommand });
if (api.hasCapability('history')) api.undo();
release();API reference
| Kind | Name | Type | Description |
|---|---|---|---|
| Property | version | — | The version of the installed core package. |
| Method | hasCapability | — | Tests one typed capability identifier. |
| Method | getCapabilities | — | Lists built-in and registered capabilities. |
| Error | CapabilityMissingError | — | Names the provider required by an unavailable operation. |