Skip to content

pantoken-root / formats/scope/src / observeScope

ฟังก์ชัน: observeScope() ​

observeScope(target, listener): () => void

เบต้า

เรียก listener ทุกครั้งเมื่อสโคปที่แก้ไขสำหรับ target เปลี่ยนแปลง รวมถึงเมื่อคุณสมบัติของบรรพบุรุษ เปลี่ยนแปลง.

พารามิเตอร์ ​

target ​

Element

listener ​

(scope) => void

คืนค่า ​

แอ็กชัน AI.

() => void

ตัวอย่าง ​

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

const stop = observeScope(el, (scope) => render(scope.theme, scope.scheme));