How to use the options function from preact

Find comprehensive JavaScript preact.options code examples handpicked from public code repositorys.

The preact.options object provides global configuration options for the Preact library.

0
1
2
3
4
5
6
7
8
9
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.forwardRef = exports.REACT_FORWARD_SYMBOL = void 0;
var preact_1 = require("preact");
var util_1 = require("./util");
var oldDiffHook = preact_1.options._diff;
preact_1.options._diff = function (vnode) {
    if (vnode.type && vnode.type._forwarded && vnode.ref) {
        vnode.props.ref = vnode.ref;
        vnode.ref = null;
fork icon4
star icon7
watch icon0

526
527
528
529
530
531
532
533
534
535
var t,
    u,
    r,
    o = 0,
    i = [],
    c = _preact.options.__b,
    f = _preact.options.__r,
    e = _preact.options.diffed,
    a = _preact.options.__c,
    v = _preact.options.unmount;
fork icon0
star icon0
watch icon1

+ 104 other calls in file

How does preact.options work?

preact.options is an object that holds various options for configuring the behavior of the Preact library, such as debounceRendering which specifies whether Preact should debounce its rendering cycles or not.

20
21
22
23
24
25
26
27
28
29
}
// HACKS...
// TODO: lock version
// TODO: link gh issues
function flushToDom() {
    var oldDebounceRendering = preact.options.debounceRendering; // orig
    var callbackQ = [];
    function execCallbackSync(callback) {
        callbackQ.push(callback);
    }
fork icon0
star icon0
watch icon0

+ 17 other calls in file

Ai Example

1
2
import { options } from "preact";
options.debounceRendering = true;