Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
30 lines
785 B
Plaintext
30 lines
785 B
Plaintext
"use client";
|
|
|
|
// src/context.ts
|
|
import * as React from "react";
|
|
function createContext2(options = {}) {
|
|
const {
|
|
strict = true,
|
|
errorMessage = "useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",
|
|
name
|
|
} = options;
|
|
const Context = React.createContext(void 0);
|
|
Context.displayName = name;
|
|
function useContext2() {
|
|
var _a;
|
|
const context = React.useContext(Context);
|
|
if (!context && strict) {
|
|
const error = new Error(errorMessage);
|
|
error.name = "ContextError";
|
|
(_a = Error.captureStackTrace) == null ? void 0 : _a.call(Error, error, useContext2);
|
|
throw error;
|
|
}
|
|
return context;
|
|
}
|
|
return [Context.Provider, useContext2, Context];
|
|
}
|
|
|
|
export {
|
|
createContext2 as createContext
|
|
};
|