@mosohq/magic-link-sdk
v0.1.9
Published
<h3 align="center">Moso Magic Link SDK</h3>
Downloads
427
Readme
Table of Contents
Getting Started
Getting started with Moso Magic Links SDK is very easy and fast. Developers can either import the script in their existing files, or create new files (below) and add those to the manifest.
Installation
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
// Script is self executing
import '@mosohq/magic-link-sdk/dist/main';
isolated-world.js
// Script is self executing
import '@mosohq/magic-link-sdk/dist/isolated';
manifest.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
// Script is self executing
import '@mosohq/magic-link-sdk/dist/main';
isolated-world.js
// Script is self executing
import '@mosohq/magic-link-sdk/dist/isolated';