despia-native 1.0.10 → 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 +103 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Despia SDK
2
2
 
3
+ ## Quick Start
4
+
5
+ **Install the SDK:**
6
+ ```bash
7
+ npm install despia-native
8
+ ```
9
+
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
+ ```
20
+
21
+ **Note:** Always use the real SDK package. Mock implementations will not work on actual devices.
22
+
23
+ ---
24
+
3
25
  JavaScript SDK for [Despia](https://despia.com) - Transform your web app into a native iOS & Android app without writing Swift or Kotlin. This npm package provides command queuing and variable watching for seamless integration with Despia's GPU-accelerated native runtime, enabling access to 25+ device APIs through simple JavaScript calls.
4
26
 
5
27
  **Import:** `import despia from 'despia-native';` (default export, not destructured)
@@ -45,12 +67,46 @@ Our visual editor allows you to configure native widgets, shortcuts, and dynamic
45
67
  - **UI Controls** - Loading indicators, navigation bars, dynamic layouts
46
68
  - **Plus 8+ additional native capabilities**
47
69
 
48
- ## Installation
70
+ ## Installation (REQUIRED - NO EXCEPTIONS)
49
71
 
50
72
  ```bash
51
73
  npm install despia-native
52
74
  ```
53
75
 
76
+ **This is NOT optional. Your app will NOT work without this package.**
77
+
78
+ **Do not attempt to:**
79
+ - Write your own version
80
+ - Copy/paste a mock implementation
81
+ - Use window.despia directly in frameworks
82
+ - Create a "simplified" version
83
+
84
+ **The real SDK is required for ANY Despia functionality to work.**
85
+
86
+ ## Important Notes
87
+
88
+ ### Simple Function API
89
+ The SDK exports a single function - no initialization or setup required:
90
+
91
+ ```javascript
92
+ import despia from 'despia-native';
93
+
94
+ // Just call it directly
95
+ despia('lighthaptic://');
96
+ despia('takescreenshot://');
97
+ ```
98
+
99
+ ### Common Mistakes to Avoid
100
+ ```javascript
101
+ // Don't create mock implementations
102
+ const despia = (command) => console.log(command); // Won't work on devices
103
+
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
108
+ ```
109
+
54
110
  ## Getting Started
55
111
 
56
112
  ### Step 1: Import Despia SDK
@@ -75,9 +131,11 @@ const despia = require('despia-native');
75
131
 
76
132
  **The SDK exports a single function called `despia` as the default export.**
77
133
 
78
- ### Step 2: Use Native Features
134
+ ### Step 2: Use Native Features (No Setup Required)
79
135
 
80
136
  ```javascript
137
+ // That's it! No initialization needed. Just call despia() directly:
138
+
81
139
  // Simple commands (no response needed)
82
140
  despia('lighthaptic://'); // Light haptic feedback
83
141
  despia('takescreenshot://'); // Take screenshot
@@ -187,6 +245,49 @@ const result = await despia('getappversion://', ['versionNumber']); // Variable
187
245
 
188
246
  **This package is REQUIRED for TypeScript, React, Vue, Angular, and other modern frameworks.**
189
247
 
248
+ ## Development Notes
249
+
250
+ ### Environment Detection
251
+ The SDK only works within the Despia native runtime. For development and testing:
252
+
253
+ ```javascript
254
+ import despia from 'despia-native';
255
+
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
+ ```
264
+
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
269
+
270
+ ## Handling Non-Despia Environments
271
+
272
+ The SDK won't work outside the Despia native runtime, but you can detect and handle this:
273
+
274
+ ```javascript
275
+ import despia from 'despia-native';
276
+
277
+ // Check if running in Despia native runtime
278
+ if (navigator.userAgent.includes('despia')) {
279
+ // Use Despia native features
280
+ despia('lighthaptic://');
281
+ const appInfo = await despia('getappversion://', ['versionNumber']);
282
+ } else {
283
+ // Handle non-Despia environment (browser, development, etc.)
284
+ console.log('Running outside Despia runtime - native features unavailable');
285
+ // Provide fallback behavior or show appropriate message
286
+ }
287
+ ```
288
+
289
+ **This is the correct way to handle different environments - use the real SDK with proper detection, never mock it.**
290
+
190
291
  ## Usage
191
292
 
192
293
  ### Basic Despia Command Execution
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "despia-native",
3
- "version": "1.0.10",
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",