This commit is contained in:
BIN
examples/plasmo-browserext/assets/icon.png
Normal file
BIN
examples/plasmo-browserext/assets/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
5
examples/plasmo-browserext/background.ts
Normal file
5
examples/plasmo-browserext/background.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { init, trackEvent } from '@aptabase/browser';
|
||||
|
||||
init('A-DEV-0000000000');
|
||||
|
||||
trackEvent('background_service_started');
|
||||
33
examples/plasmo-browserext/package.json
Normal file
33
examples/plasmo-browserext/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "plasmo-browserext",
|
||||
"private": true,
|
||||
"displayName": "Plasmo browserext",
|
||||
"version": "0.0.1",
|
||||
"description": "A basic Plasmo extension.",
|
||||
"author": "Plasmo Corp. <foss@plasmo.com>",
|
||||
"scripts": {
|
||||
"dev": "plasmo dev",
|
||||
"build": "plasmo build",
|
||||
"test": "plasmo test"
|
||||
},
|
||||
"dependencies": {
|
||||
"plasmo": "0.84.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"@aptabase/browser": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chrome": "0.0.254",
|
||||
"@types/react": "18.2.45",
|
||||
"@types/react-dom": "18.2.17",
|
||||
"typescript": "5.3.3"
|
||||
},
|
||||
"manifest": {
|
||||
"permissions": [
|
||||
"storage"
|
||||
],
|
||||
"host_permissions": [
|
||||
"https://*/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
25
examples/plasmo-browserext/popup.tsx
Normal file
25
examples/plasmo-browserext/popup.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { trackEvent } from '@aptabase/browser';
|
||||
import { useState } from 'react';
|
||||
|
||||
function IndexPopup() {
|
||||
const [count, setCount] = useState(0);
|
||||
|
||||
function increment() {
|
||||
trackEvent('increment', { count: count + 1 });
|
||||
setCount((c) => c + 1);
|
||||
}
|
||||
|
||||
function decrement() {
|
||||
trackEvent('decrement', { count: count - 1 });
|
||||
setCount((c) => c - 1);
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<button onClick={increment}>Increment</button>
|
||||
<button onClick={decrement}>decrement</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default IndexPopup;
|
||||
11
examples/plasmo-browserext/tsconfig.json
Normal file
11
examples/plasmo-browserext/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "plasmo/templates/tsconfig.base",
|
||||
"exclude": ["node_modules"],
|
||||
"include": [".plasmo/index.d.ts", "./**/*.ts", "./**/*.tsx"],
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"~*": ["./*"]
|
||||
},
|
||||
"baseUrl": "."
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user