Skip to content

pantoken-root / formats/scope/src / createScope

函式: createScope() ​

createScope(element, options?): PantokenScope

Beta(測試)

在 element 上建立一個根作用域。

參數 ​

element ​

HTMLElement

options? ​

CreateScopeOptions = {}

回傳 ​

PantokenScope

範例 ​

同一頁面上的兩個獨立主題

ts
import { createScope } from "@pantoken/scope";

createScope(document.querySelector("#app")!, { theme: "rebrand", scheme: "dark" });
createScope(document.querySelector("#preview")!, {
  instanceId: "preview",
  theme: "canvas",
  scheme: "light",
  boundary: true,
});