<h3 align="center">Moso Magic Link SDK</h3>
npm install @mosohq/magic-link-sdk
npm install @mosohq/magic-link-sdk
`Usage
This SDK relies on chrome manifest v3 using the concept of Isolated and Main content scripts. The Isolated and Main worlds each have a script that needs to be imported. There are no exports from the scripts, they are self executing to ensure they run on load.
Example 1:
Create
main-world.js and isolated-world.js scripts in your extension. In each file, import the respective files.main-world.js
`javascript
// Script is self executing
import '@mosohq/magic-link-sdk/dist/main';
`isolated-world.js
`javascript
// Script is self executing
import '@mosohq/magic-link-sdk/dist/isolated';
`manifest.json
`json
{
...
"content_scripts": [
{
"matches": [
"https:///"
],
"js": [
"isolated-world.js"
]
},
{
"matches": [
"https:///"
],
"js": [
"main-world.js"
],
"world": "MAIN"
}
]
...
}
`
Example 2:
If your extension already has a Main and Isolated world scripts, you can import the files instead:
main-world.js
`javascript
// Script is self executing
import '@mosohq/magic-link-sdk/dist/main';
`isolated-world.js
`javascript
// Script is self executing
import '@mosohq/magic-link-sdk/dist/isolated';
``