* User function to enable user locator features. Such as element hover and go to source. * * Can bu used only once. * * @param options LocatorOptions for the locator.
(options: locator.LocatorOptions)
| 188 | * @param options {@link LocatorOptions} for the locator. |
| 189 | */ |
| 190 | function useLocator(options: locator.LocatorOptions): void { |
| 191 | s.runWithOwner(owner, () => { |
| 192 | if (locatorUsed) return warn('useLocator can be called only once.') |
| 193 | locatorUsed = true |
| 194 | if (options.targetIDE) target_ide = options.targetIDE |
| 195 | if (options.key !== false) { |
| 196 | const isHoldingKey = createKeyHold(options.key ?? 'Alt', {preventDefault: true}) |
| 197 | setEnabledByPressingSignal(() => isHoldingKey) |
| 198 | } |
| 199 | }) |
| 200 | } |
| 201 | |
| 202 | // Enable the locator when the options were passed by the vite plugin |
| 203 | let locator_options = SolidAPI.get_locator_options() |
no test coverage detected
searching dependent graphs…