UNPKG

context-protocol

Version:

A fully-typed implementation of the context-protocol, with support for subscriptions.

1 lines 689 B
import{addContextListener,getContextValue,removeContextListener,setContextValue}from"./subscriptions.js";import{ContextRequestEvent,createContext}from"./context.js";var ContextConsumerMixin=(Target)=>class extends Target{addContextListener(context,callback,subscribe=null){addContextListener(this,context,callback,subscribe)}removeContextListener(context,callback){removeContextListener(this,context,callback)}},ContextProviderMixin=(Target)=>class extends Target{setContextValue(context,value){setContextValue(this,context,value)}};export{setContextValue,removeContextListener,getContextValue,createContext,addContextListener,ContextRequestEvent,ContextProviderMixin,ContextConsumerMixin}