Init
This commit is contained in:
21
node_modules/preact/devtools/src/devtools.js
generated
vendored
Normal file
21
node_modules/preact/devtools/src/devtools.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Component, Fragment, options } from 'preact';
|
||||
|
||||
export function initDevTools() {
|
||||
const globalVar =
|
||||
typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
: undefined;
|
||||
|
||||
if (
|
||||
globalVar !== null &&
|
||||
globalVar !== undefined &&
|
||||
globalVar.__PREACT_DEVTOOLS__
|
||||
) {
|
||||
globalVar.__PREACT_DEVTOOLS__.attachPreact('10.26.9', options, {
|
||||
Fragment,
|
||||
Component
|
||||
});
|
||||
}
|
||||
}
|
8
node_modules/preact/devtools/src/index.d.ts
generated
vendored
Normal file
8
node_modules/preact/devtools/src/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Customize the displayed name of a useState, useReducer or useRef hook
|
||||
* in the devtools panel.
|
||||
*
|
||||
* @param value Wrapped native hook.
|
||||
* @param name Custom name
|
||||
*/
|
||||
export function addHookName<T>(value: T, name: string): T;
|
15
node_modules/preact/devtools/src/index.js
generated
vendored
Normal file
15
node_modules/preact/devtools/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { options } from 'preact';
|
||||
import { initDevTools } from './devtools';
|
||||
|
||||
initDevTools();
|
||||
|
||||
/**
|
||||
* Display a custom label for a custom hook for the devtools panel
|
||||
* @type {<T>(value: T, name: string) => T}
|
||||
*/
|
||||
export function addHookName(value, name) {
|
||||
if (options._addHookName) {
|
||||
options._addHookName(name);
|
||||
}
|
||||
return value;
|
||||
}
|
Reference in New Issue
Block a user