
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
a utility for passing environment/config info from server to client
pnpm -D add icefog
On the server, create a config string:
import { createConfig } from 'icefog/server'
const configString = createConfig({ isDev: true, token: 'abc' })
// then add this string to your rendered markup
// e.g. - `<div id="app" ${configString}></div>`
Then on the client, read the config string:
import 'icefog/init' // for the default element of '#app'
or
import { initConfig } from 'icefog'
initConfig('my-dom-element')
the config
export is then available for use anywhere in your app:
import { config } from 'icefog'
if (config.isDev) // do development-specific things
createConfig(config: object): string
Creates a base64-encoded, stringified version of the object provided.
initConfig(element: (Element | string) = '#app', { windowAttr: string = 'configs', configId: string = '_id' })
element
is the DOM element you render the configString onto and can be either an Element or a querySelectorEffectively the object you provided to createConfig
, with any functions stripped
getConfig(element: (Element | string) = '#app')
Returns the config found on the element and removes it.
useConfig()
Returns the config
export, useful in a Typescript environment
FAQs
a utility for passing environment/config info from server to client
The npm package icefog receives a total of 2 weekly downloads. As such, icefog popularity was classified as not popular.
We found that icefog demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.