![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
bifrost-cors
Advanced tools
A cross-domain communication solution to share data and many more functionalities with simple as just calling a method.
All above methods are wrapped in a promise.
var bifrostCors = new bifrostCors(address, iframeBoolean,iframeId)
Parameter | Required | Value |
---|---|---|
address | YES | Exact Address of the other domain |
iframeBoolean | No | true :- If you already rendering the other domain in iframe false If you are not rendering the other domain in iframe Default false |
iframeId | No | if iframeBoolean is set to true then you need to pass the ID for your Iframe in which you loading the other domain |
======= |
var bifrostCors = new bifrostCors("http://example.com/",false)
//Calling Methods without promise
var result = bifrostCors.getLocalStorage(key)
//Hanlde Promise
//1. Using .then()
bifrostCors.getLocalStorage(key).then((data) => {
console.log(data)
})
//2. Using async function
async function grabLocalStorage(){
let result = await bifrostCors.getLocalStorage(key)
}
Cookies
// return type Object, return all cookies
bifrostCors.getCookie()
// return type string
bifrostCors.getCookie("key")
bifrostCors.setCookie(name,value,days)
LocalStorage
// return type stirng
bifrostCors.getgetLocalStorage("key")
// return type array
bifrostCors.getLocalStorage(["key1","key2"])
// return type Boolean
bifrostCors.setLocalStorage("key")
// return type Boolean
bifrostCors.setLocalStorage(["key1","key2"])
// return type Boolean
bifrostCors.deleteLocalStorage("key")
// return type Boolean
bifrostCors.deleteLocalStorage(["key1","key2"])
Bi-directional message thread
// return type Boolean, parameter type funtion
bifrostCors.requestMessageThread(Listner)
Listner is your custom function which will be invoked every time new message recivied, and it should expect a new message as a parameter
Here's exapmle
function myCustomListner(newMessage){
cosnole.log("Hurray I got new message ",newMessage)
}
bifrostCors.requestMessageThread(myCustomListner)
// return type Boolean, parameter type string|int|array|object
bifrostCors.send(message)
Run JS expression
// return type Boolean, parameter type string
bifrostCors.runExpression(expression)
DOM Manipulation
// return type Boolean, parameter type string
bifrostCors.domManipulationById("yourElementID")
// return type Boolean, parameter type string,int,Objet
bifrostCors.domManipulationById(class,index,style)
FAQs
A cross-domain utility lib, for sharing localStorage, cookie and many more over the cross domain
The npm package bifrost-cors receives a total of 99 weekly downloads. As such, bifrost-cors popularity was classified as not popular.
We found that bifrost-cors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.