despia-native 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +48 -41
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,20 +1,24 @@
1
1
  # Despia SDK
2
2
 
3
- ## CRITICAL: ALWAYS USE THE REAL SDK
4
-
5
- **NEVER mock or simulate the Despia SDK. ALWAYS install and use the real package:**
3
+ ## Quick Start
6
4
 
5
+ **Install the SDK:**
7
6
  ```bash
8
7
  npm install despia-native
9
8
  ```
10
9
 
11
- **Why?**
12
- - The SDK handles critical native bridge communication
13
- - Mocking will break ALL native features
14
- - Your app will NOT work on actual devices without the real SDK
15
- - There is NO valid reason to mock this in any scenario
10
+ **Use it immediately:**
11
+ ```javascript
12
+ import despia from 'despia-native';
13
+
14
+ // Simple commands
15
+ despia('lighthaptic://');
16
+
17
+ // Commands with responses
18
+ const appInfo = await despia('getappversion://', ['versionNumber']);
19
+ ```
16
20
 
17
- **If you see any tutorial, example, or code that creates a fake despia function - it's WRONG.**
21
+ **Note:** Always use the real SDK package. Mock implementations will not work on actual devices.
18
22
 
19
23
  ---
20
24
 
@@ -79,30 +83,28 @@ npm install despia-native
79
83
 
80
84
  **The real SDK is required for ANY Despia functionality to work.**
81
85
 
82
- ## NEVER DO THIS - YOUR APP WILL NOT WORK
86
+ ## Important Notes
83
87
 
84
- ```javascript
85
- // WRONG - This breaks everything
86
- const despia = (command) => {
87
- console.log('Command:', command);
88
- // This does NOTHING on real devices
89
- };
88
+ ### Simple Function API
89
+ The SDK exports a single function - no initialization or setup required:
90
90
 
91
- // WRONG - This also breaks everything
92
- const mockDespia = () => { /* ... */ };
91
+ ```javascript
92
+ import despia from 'despia-native';
93
93
 
94
- // WRONG - Don't create your own version
95
- window.despia = 'somecommand://';
94
+ // Just call it directly
95
+ despia('lighthaptic://');
96
+ despia('takescreenshot://');
96
97
  ```
97
98
 
98
- ## ALWAYS DO THIS - THE ONLY CORRECT WAY
99
-
99
+ ### Common Mistakes to Avoid
100
100
  ```javascript
101
- // CORRECT - The ONLY way to use Despia
102
- import despia from 'despia-native';
101
+ // Don't create mock implementations
102
+ const despia = (command) => console.log(command); // Won't work on devices
103
103
 
104
- // Now your commands actually work
105
- despia('lighthaptic://'); // Device actually vibrates
104
+ // Don't use non-existent methods
105
+ despia.ready(); // This method doesn't exist
106
+ despia.init(); // This method doesn't exist
107
+ despia.setup(); // This method doesn't exist
106
108
  ```
107
109
 
108
110
  ## Getting Started
@@ -129,9 +131,11 @@ const despia = require('despia-native');
129
131
 
130
132
  **The SDK exports a single function called `despia` as the default export.**
131
133
 
132
- ### Step 2: Use Native Features
134
+ ### Step 2: Use Native Features (No Setup Required)
133
135
 
134
136
  ```javascript
137
+ // That's it! No initialization needed. Just call despia() directly:
138
+
135
139
  // Simple commands (no response needed)
136
140
  despia('lighthaptic://'); // Light haptic feedback
137
141
  despia('takescreenshot://'); // Take screenshot
@@ -241,24 +245,27 @@ const result = await despia('getappversion://', ['versionNumber']); // Variable
241
245
 
242
246
  **This package is REQUIRED for TypeScript, React, Vue, Angular, and other modern frameworks.**
243
247
 
244
- ## No Exceptions - Always Use Real SDK
248
+ ## Development Notes
245
249
 
246
- **Q: What if I'm just testing locally?**
247
- A: Use the real SDK. It won't work outside the native runtime, but you can set up callbacks for when user agent doesn't include "despia".
250
+ ### Environment Detection
251
+ The SDK only works within the Despia native runtime. For development and testing:
248
252
 
249
- **Q: What if I'm making a demo?**
250
- A: Use the real SDK. Set up fallbacks for browsers without Despia runtime.
251
-
252
- **Q: What if I'm writing unit tests?**
253
- A: Use the real SDK. It won't work in test environments, but you can handle the missing runtime gracefully.
254
-
255
- **Q: What if I'm developing without a device?**
256
- A: Use the real SDK. It won't work outside native runtime, but you can detect and handle this case.
253
+ ```javascript
254
+ import despia from 'despia-native';
257
255
 
258
- **Q: What if I'm using AI to generate code?**
259
- A: Tell the AI to use the real SDK. Never accept mock implementations.
256
+ if (navigator.userAgent.includes('despia')) {
257
+ // Use native features
258
+ despia('lighthaptic://');
259
+ } else {
260
+ // Handle non-Despia environment
261
+ console.log('Running outside Despia runtime');
262
+ }
263
+ ```
260
264
 
261
- **There is NEVER a valid reason to mock this SDK.**
265
+ ### Always Use the Real Package
266
+ - Use the real SDK in all environments (development, testing, production)
267
+ - Don't create mock implementations - they won't work on actual devices
268
+ - The SDK handles missing runtime gracefully
262
269
 
263
270
  ## Handling Non-Despia Environments
264
271
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "despia-native",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "JavaScript SDK for Despia native integrations with command queuing and variable watching",
5
5
  "main": "index.js",
6
6
  "module": "index.js",