@bobfrankston/msger 0.1.74 → 0.1.76
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.
- package/KNOWN-BUGS.md +121 -0
- package/MSGER-API-SUMMARY.md +162 -0
- package/MSGER-API.md +376 -0
- package/README.md +93 -0
- package/SESSION-2025-11-06.md +191 -0
- package/SESSION-NOTES.md +678 -0
- package/clihandler.d.ts.map +1 -1
- package/clihandler.js +62 -2
- package/clihandler.js.map +1 -1
- package/clihandler.ts +60 -2
- package/icon.png +0 -0
- package/icon1.png +0 -0
- package/msger-native/Cargo.toml +1 -0
- package/msger-native/bin/msgernative.exe +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Breadcrumbs +12 -118
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/BrowserMetrics/{BrowserMetrics-690552AF-DCD4.pma → BrowserMetrics-690B9AD3-657C.pma} +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/BrowserMetrics/{BrowserMetrics-69055373-F88C.pma → BrowserMetrics-690BA05A-501C.pma} +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Crashpad/settings.dat +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/BrowsingTopicsState +1 -1
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/data_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/{BrowserMetrics/BrowserMetrics-69055587-A65C.pma → Default/Cache/Cache_Data/data_2} +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/data_3 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000001 +383 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000002 +1091 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000003 +2153 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000004 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000005 +626 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000006 +393 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/01241693cfdc32b9_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/0ba1eea781f3552c_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/323aa210eebefe2c_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/4608446ac118e77a_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/6938205dc2f77841_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/6de12299dc89e5f3_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/8f403c112eaa455b_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/9a3aceb491137f07_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/aedb266cbaf9c28f_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/ca526fdda86d0b9d_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/f5d11d783c9fdf69_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/index-dir/the-real-index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Collections/collectionsSQLite +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Collections/collectionsSQLite-journal +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/DIPS +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/DawnGraphiteCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/DawnGraphiteCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/DawnWebGPUCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/DawnWebGPUCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Extension State/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Extension State/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Favicons +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/GPUCache/data_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/GPUCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/GPUCache/data_2 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/GPUCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/History +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Local Storage/leveldb/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Local Storage/leveldb/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Local Storage/leveldb/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/MediaDeviceSalts +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/MediaDeviceSalts-journal +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Network/Network Persistent State +1 -1
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Network/TransportSecurity +1 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Preferences +1 -1
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/CacheStorage/14e849fa8522d406112ea607cf7fd6342b71b987/249ee9af-c3df-4a86-89a8-2c51f3370ee0/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/CacheStorage/14e849fa8522d406112ea607cf7fd6342b71b987/249ee9af-c3df-4a86-89a8-2c51f3370ee0/index-dir/the-real-index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/CacheStorage/14e849fa8522d406112ea607cf7fd6342b71b987/index.txt +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/CURRENT +1 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/LOCK +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/LOG +3 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/LOG.old +3 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/MANIFEST-000001 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/ScriptCache/2cc80dabc69f58b6_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/ScriptCache/2cc80dabc69f58b6_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/ScriptCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/ScriptCache/index-dir/the-real-index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Session Storage/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Session Storage/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Session Storage/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Site Characteristics Database/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Site Characteristics Database/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Site Characteristics Database/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Sync Data/LevelDB/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Sync Data/LevelDB/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/WebStorage/QuotaManager +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/WebStorage/QuotaManager-journal +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/favorites_diagnostic.log +27 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/data_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/data_3 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/f_000003 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/f_000004 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GraphiteDawnCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GraphiteDawnCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Local State +1 -1
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/RevisitationBloomfilter +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/ShaderCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/ShaderCache/index +0 -0
- package/msger-native/src/main.rs +343 -37
- package/msger-native/src/template.html +103 -28
- package/msger-storage-demo.html +290 -0
- package/msger.code-workspace +3 -0
- package/msgerdefs/README.md +122 -0
- package/msgerdefs/msgerdefs.d.ts +322 -0
- package/msgerdefs/msgerdefs.d.ts.map +1 -0
- package/msgerdefs/msgerdefs.js +110 -0
- package/msgerdefs/msgerdefs.js.map +1 -0
- package/msgerdefs/msgerdefs.ts +427 -0
- package/msgerdefs/package.json +38 -0
- package/msgerdefs/samples.html +431 -0
- package/msgerdefs/test1.cmd +1 -0
- package/msgerdefs/tsconfig.json +17 -0
- package/msgernative-linux-x64 +0 -0
- package/package.json +5 -1
- package/shower.d.ts +2 -0
- package/shower.d.ts.map +1 -1
- package/shower.js +17 -0
- package/shower.js.map +1 -1
- package/shower.ts +24 -0
- package/test-data-persistence.html +315 -0
- package/test-htmlfrom.html +29 -0
- package/test-ipc-reach.html +113 -0
- package/test-msger-api.html +120 -0
- package/test-msger-functions.html +325 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/BrowserMetrics/BrowserMetrics-69055419-C8A0.pma +0 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Test Data Persistence</title>
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
font-family: monospace;
|
|
9
|
+
padding: 20px;
|
|
10
|
+
background: #2d2d2d;
|
|
11
|
+
color: #d4d4d4;
|
|
12
|
+
}
|
|
13
|
+
button {
|
|
14
|
+
margin: 5px;
|
|
15
|
+
padding: 10px 15px;
|
|
16
|
+
background: #0e639c;
|
|
17
|
+
color: white;
|
|
18
|
+
border: none;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
}
|
|
21
|
+
button:hover { background: #1177bb; }
|
|
22
|
+
.output {
|
|
23
|
+
margin: 10px 0;
|
|
24
|
+
padding: 15px;
|
|
25
|
+
background: #1e1e1e;
|
|
26
|
+
border-left: 3px solid #4ec9b0;
|
|
27
|
+
white-space: pre-wrap;
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
}
|
|
30
|
+
input, textarea {
|
|
31
|
+
padding: 8px;
|
|
32
|
+
margin: 5px;
|
|
33
|
+
background: #1e1e1e;
|
|
34
|
+
color: #d4d4d4;
|
|
35
|
+
border: 1px solid #3c3c3c;
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
38
|
+
</head>
|
|
39
|
+
<body>
|
|
40
|
+
<h1>msger Data Persistence Test</h1>
|
|
41
|
+
|
|
42
|
+
<h2>Test 1: Basic Save/Load</h2>
|
|
43
|
+
<input type="text" id="key1" value="testKey" placeholder="Key">
|
|
44
|
+
<input type="text" id="value1" value="Hello World" placeholder="Value">
|
|
45
|
+
<button onclick="testBasicSave()">Save</button>
|
|
46
|
+
<button onclick="testBasicLoad()">Load</button>
|
|
47
|
+
<button onclick="testBasicRemove()">Remove</button>
|
|
48
|
+
<div id="output1" class="output"></div>
|
|
49
|
+
|
|
50
|
+
<h2>Test 2: Complex Objects</h2>
|
|
51
|
+
<button onclick="testComplexSave()">Save Complex Object</button>
|
|
52
|
+
<button onclick="testComplexLoad()">Load Complex Object</button>
|
|
53
|
+
<div id="output2" class="output"></div>
|
|
54
|
+
|
|
55
|
+
<h2>Test 3: Arrays and Nested Data</h2>
|
|
56
|
+
<button onclick="testArraySave()">Save Array</button>
|
|
57
|
+
<button onclick="testArrayLoad()">Load Array</button>
|
|
58
|
+
<div id="output3" class="output"></div>
|
|
59
|
+
|
|
60
|
+
<h2>Test 4: Large Data</h2>
|
|
61
|
+
<button onclick="testLargeData()">Save Large String (100KB)</button>
|
|
62
|
+
<button onclick="testLoadLargeData()">Load Large String</button>
|
|
63
|
+
<div id="output4" class="output"></div>
|
|
64
|
+
|
|
65
|
+
<h2>Test 5: List All Keys</h2>
|
|
66
|
+
<button onclick="listAllKeys()">List All msger_* Keys</button>
|
|
67
|
+
<button onclick="clearAllData()">Clear All msger Data</button>
|
|
68
|
+
<div id="output5" class="output"></div>
|
|
69
|
+
|
|
70
|
+
<h2>Test 6: File-Like Operations (No IPC)</h2>
|
|
71
|
+
<textarea id="fileContent" rows="5" cols="50" placeholder="Enter file content here..."></textarea><br>
|
|
72
|
+
<button onclick="saveAsFile()">Save as "Virtual File"</button>
|
|
73
|
+
<button onclick="loadFile()">Load "Virtual File"</button>
|
|
74
|
+
<button onclick="exportFile()">Export (Download)</button>
|
|
75
|
+
<div id="output6" class="output"></div>
|
|
76
|
+
|
|
77
|
+
<script>
|
|
78
|
+
function log(id, msg, color = '#4ec9b0') {
|
|
79
|
+
const el = document.getElementById(id);
|
|
80
|
+
el.style.borderLeftColor = color;
|
|
81
|
+
el.textContent = `[${new Date().toLocaleTimeString()}] ${msg}`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Test 1: Basic Save/Load (with timestamp)
|
|
85
|
+
function testBasicSave() {
|
|
86
|
+
try {
|
|
87
|
+
const key = document.getElementById('key1').value;
|
|
88
|
+
const value = document.getElementById('value1').value;
|
|
89
|
+
const dataWithTimestamp = {
|
|
90
|
+
value: value,
|
|
91
|
+
savedAt: new Date().toISOString(),
|
|
92
|
+
savedTimestamp: Date.now()
|
|
93
|
+
};
|
|
94
|
+
const result = msger.saveData(key, dataWithTimestamp);
|
|
95
|
+
log('output1', `Save result: ${result}\nKey: ${key}\nValue: ${value}\nSaved at: ${dataWithTimestamp.savedAt}`, result ? '#4ec9b0' : '#f48771');
|
|
96
|
+
} catch(e) {
|
|
97
|
+
log('output1', `ERROR: ${e.message}`, '#f48771');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function testBasicLoad() {
|
|
102
|
+
try {
|
|
103
|
+
const key = document.getElementById('key1').value;
|
|
104
|
+
const data = msger.loadData(key, null);
|
|
105
|
+
if (data) {
|
|
106
|
+
const savedDate = new Date(data.savedAt);
|
|
107
|
+
const now = new Date();
|
|
108
|
+
const ageMs = now - savedDate;
|
|
109
|
+
const ageSec = Math.floor(ageMs / 1000);
|
|
110
|
+
const ageMin = Math.floor(ageSec / 60);
|
|
111
|
+
const ageHr = Math.floor(ageMin / 60);
|
|
112
|
+
|
|
113
|
+
let ageStr;
|
|
114
|
+
if (ageHr > 0) {
|
|
115
|
+
ageStr = `${ageHr} hour(s) ago`;
|
|
116
|
+
} else if (ageMin > 0) {
|
|
117
|
+
ageStr = `${ageMin} minute(s) ago`;
|
|
118
|
+
} else {
|
|
119
|
+
ageStr = `${ageSec} second(s) ago`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
log('output1', `Load result:\nKey: ${key}\nValue: ${data.value}\nSaved at: ${data.savedAt}\nAge: ${ageStr}\n\nThis data PERSISTS across restarts!`, '#4ec9b0');
|
|
123
|
+
} else {
|
|
124
|
+
log('output1', `Key "${key}" not found`, '#dcdcaa');
|
|
125
|
+
}
|
|
126
|
+
} catch(e) {
|
|
127
|
+
log('output1', `ERROR: ${e.message}`, '#f48771');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function testBasicRemove() {
|
|
132
|
+
try {
|
|
133
|
+
const key = document.getElementById('key1').value;
|
|
134
|
+
const result = msger.removeData(key);
|
|
135
|
+
log('output1', `Remove result: ${result}\nKey: ${key}`, result ? '#4ec9b0' : '#f48771');
|
|
136
|
+
} catch(e) {
|
|
137
|
+
log('output1', `ERROR: ${e.message}`, '#f48771');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Test 2: Complex Objects
|
|
142
|
+
function testComplexSave() {
|
|
143
|
+
try {
|
|
144
|
+
const complexData = {
|
|
145
|
+
user: {
|
|
146
|
+
name: 'Bob',
|
|
147
|
+
age: 30,
|
|
148
|
+
settings: {
|
|
149
|
+
theme: 'dark',
|
|
150
|
+
notifications: true
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
timestamp: Date.now()
|
|
154
|
+
};
|
|
155
|
+
const result = msger.saveData('complexObject', complexData);
|
|
156
|
+
log('output2', `Save complex object: ${result}\n${JSON.stringify(complexData, null, 2)}`, result ? '#4ec9b0' : '#f48771');
|
|
157
|
+
} catch(e) {
|
|
158
|
+
log('output2', `ERROR: ${e.message}`, '#f48771');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function testComplexLoad() {
|
|
163
|
+
try {
|
|
164
|
+
const data = msger.loadData('complexObject', null);
|
|
165
|
+
log('output2', `Loaded complex object:\n${JSON.stringify(data, null, 2)}`, '#4ec9b0');
|
|
166
|
+
} catch(e) {
|
|
167
|
+
log('output2', `ERROR: ${e.message}`, '#f48771');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Test 3: Arrays
|
|
172
|
+
function testArraySave() {
|
|
173
|
+
try {
|
|
174
|
+
const arrayData = [
|
|
175
|
+
{ id: 1, name: 'Item 1' },
|
|
176
|
+
{ id: 2, name: 'Item 2' },
|
|
177
|
+
{ id: 3, name: 'Item 3' }
|
|
178
|
+
];
|
|
179
|
+
const result = msger.saveData('arrayData', arrayData);
|
|
180
|
+
log('output3', `Save array: ${result}\n${JSON.stringify(arrayData, null, 2)}`, result ? '#4ec9b0' : '#f48771');
|
|
181
|
+
} catch(e) {
|
|
182
|
+
log('output3', `ERROR: ${e.message}`, '#f48771');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function testArrayLoad() {
|
|
187
|
+
try {
|
|
188
|
+
const data = msger.loadData('arrayData', []);
|
|
189
|
+
log('output3', `Loaded array (${data.length} items):\n${JSON.stringify(data, null, 2)}`, '#4ec9b0');
|
|
190
|
+
} catch(e) {
|
|
191
|
+
log('output3', `ERROR: ${e.message}`, '#f48771');
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Test 4: Large Data
|
|
196
|
+
function testLargeData() {
|
|
197
|
+
try {
|
|
198
|
+
const largeString = 'X'.repeat(100 * 1024); // 100KB
|
|
199
|
+
const start = performance.now();
|
|
200
|
+
const result = msger.saveData('largeData', largeString);
|
|
201
|
+
const time = (performance.now() - start).toFixed(2);
|
|
202
|
+
log('output4', `Save 100KB string: ${result}\nTime: ${time}ms\nSize: ${largeString.length} characters`, result ? '#4ec9b0' : '#f48771');
|
|
203
|
+
} catch(e) {
|
|
204
|
+
log('output4', `ERROR: ${e.message}`, '#f48771');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function testLoadLargeData() {
|
|
209
|
+
try {
|
|
210
|
+
const start = performance.now();
|
|
211
|
+
const data = msger.loadData('largeData', '');
|
|
212
|
+
const time = (performance.now() - start).toFixed(2);
|
|
213
|
+
log('output4', `Loaded large data:\nTime: ${time}ms\nSize: ${data.length} characters`, '#4ec9b0');
|
|
214
|
+
} catch(e) {
|
|
215
|
+
log('output4', `ERROR: ${e.message}`, '#f48771');
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Test 5: List Keys
|
|
220
|
+
function listAllKeys() {
|
|
221
|
+
try {
|
|
222
|
+
const allKeys = Object.keys(localStorage);
|
|
223
|
+
const msgerKeys = allKeys.filter(k => k.startsWith('msger_'));
|
|
224
|
+
log('output5', `Found ${msgerKeys.length} msger keys:\n${msgerKeys.join('\n')}`, '#4ec9b0');
|
|
225
|
+
} catch(e) {
|
|
226
|
+
log('output5', `ERROR: ${e.message}`, '#f48771');
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function clearAllData() {
|
|
231
|
+
try {
|
|
232
|
+
if (confirm('Clear all msger_* data?')) {
|
|
233
|
+
const result = msger.clearData();
|
|
234
|
+
log('output5', `Clear all data: ${result}`, result ? '#4ec9b0' : '#f48771');
|
|
235
|
+
}
|
|
236
|
+
} catch(e) {
|
|
237
|
+
log('output5', `ERROR: ${e.message}`, '#f48771');
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Test 6: File-like operations (without real file system)
|
|
242
|
+
function saveAsFile() {
|
|
243
|
+
try {
|
|
244
|
+
const content = document.getElementById('fileContent').value;
|
|
245
|
+
const fileData = {
|
|
246
|
+
name: 'document.txt',
|
|
247
|
+
content: content,
|
|
248
|
+
size: content.length,
|
|
249
|
+
created: new Date().toISOString()
|
|
250
|
+
};
|
|
251
|
+
const result = msger.saveData('virtualFile', fileData);
|
|
252
|
+
log('output6', `Saved virtual file:\nName: ${fileData.name}\nSize: ${fileData.size} bytes\nCreated: ${fileData.created}`, result ? '#4ec9b0' : '#f48771');
|
|
253
|
+
} catch(e) {
|
|
254
|
+
log('output6', `ERROR: ${e.message}`, '#f48771');
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function loadFile() {
|
|
259
|
+
try {
|
|
260
|
+
const fileData = msger.loadData('virtualFile', null);
|
|
261
|
+
if (fileData) {
|
|
262
|
+
document.getElementById('fileContent').value = fileData.content;
|
|
263
|
+
log('output6', `Loaded virtual file:\nName: ${fileData.name}\nSize: ${fileData.size} bytes\nCreated: ${fileData.created}`, '#4ec9b0');
|
|
264
|
+
} else {
|
|
265
|
+
log('output6', 'No file found', '#dcdcaa');
|
|
266
|
+
}
|
|
267
|
+
} catch(e) {
|
|
268
|
+
log('output6', `ERROR: ${e.message}`, '#f48771');
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function exportFile() {
|
|
273
|
+
try {
|
|
274
|
+
const fileData = msger.loadData('virtualFile', null);
|
|
275
|
+
if (fileData) {
|
|
276
|
+
// Use browser download API (no IPC needed!)
|
|
277
|
+
const blob = new Blob([fileData.content], { type: 'text/plain' });
|
|
278
|
+
const url = URL.createObjectURL(blob);
|
|
279
|
+
const a = document.createElement('a');
|
|
280
|
+
a.href = url;
|
|
281
|
+
a.download = fileData.name;
|
|
282
|
+
a.click();
|
|
283
|
+
URL.revokeObjectURL(url);
|
|
284
|
+
log('output6', `Downloaded: ${fileData.name}`, '#4ec9b0');
|
|
285
|
+
} else {
|
|
286
|
+
log('output6', 'No file to export', '#dcdcaa');
|
|
287
|
+
}
|
|
288
|
+
} catch(e) {
|
|
289
|
+
log('output6', `ERROR: ${e.message}`, '#f48771');
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Auto-run on load
|
|
294
|
+
window.addEventListener('load', function() {
|
|
295
|
+
setTimeout(() => {
|
|
296
|
+
// Try to auto-load previous data to demonstrate persistence
|
|
297
|
+
const testKey = document.getElementById('key1').value;
|
|
298
|
+
const prevData = msger.loadData(testKey, null);
|
|
299
|
+
if (prevData) {
|
|
300
|
+
log('output1', '✅ FOUND PERSISTED DATA! Click "Load" to see it.', '#4ec9b0');
|
|
301
|
+
// Also list all keys
|
|
302
|
+
listAllKeys();
|
|
303
|
+
} else {
|
|
304
|
+
log('output1', 'Ready - Enter key/value and click Save', '#dcdcaa');
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
log('output2', 'Ready - Click to test complex objects', '#dcdcaa');
|
|
308
|
+
log('output3', 'Ready - Click to test arrays', '#dcdcaa');
|
|
309
|
+
log('output4', 'Ready - Click to test large data', '#dcdcaa');
|
|
310
|
+
log('output6', 'Ready - Enter content and save as virtual file', '#dcdcaa');
|
|
311
|
+
}, 500);
|
|
312
|
+
});
|
|
313
|
+
</script>
|
|
314
|
+
</body>
|
|
315
|
+
</html>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<h1>Hello from HTML File!</h1>
|
|
2
|
+
<p>This HTML was loaded using <code>-htmlfrom</code></p>
|
|
3
|
+
<p>Key differences from <code>-url</code>:</p>
|
|
4
|
+
<ul>
|
|
5
|
+
<li>✅ Embedded in template.html with OK/Cancel buttons</li>
|
|
6
|
+
<li>✅ msger API is available</li>
|
|
7
|
+
<li>✅ Can use buttons to close</li>
|
|
8
|
+
<li>✅ No CORS restrictions (loaded as file content)</li>
|
|
9
|
+
</ul>
|
|
10
|
+
|
|
11
|
+
<h2>Test msger API:</h2>
|
|
12
|
+
<button onclick="testStorage()">Test localStorage</button>
|
|
13
|
+
<button onclick="testClose()">Test Close</button>
|
|
14
|
+
<div id="output" style="margin-top:10px; padding:10px; background:#f0f0f0;"></div>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
function testStorage() {
|
|
18
|
+
msger.saveData('test', { time: new Date().toISOString() });
|
|
19
|
+
const data = msger.loadData('test');
|
|
20
|
+
document.getElementById('output').innerHTML =
|
|
21
|
+
'✅ Storage works!<br>Saved: ' + JSON.stringify(data, null, 2);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function testClose() {
|
|
25
|
+
document.getElementById('output').innerHTML =
|
|
26
|
+
'⏳ Calling msger.close()...';
|
|
27
|
+
msger.close('Test Close');
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>IPC Reachability Test</title>
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
font-family: monospace;
|
|
9
|
+
padding: 20px;
|
|
10
|
+
background: #1e1e1e;
|
|
11
|
+
color: #d4d4d4;
|
|
12
|
+
}
|
|
13
|
+
button {
|
|
14
|
+
margin: 10px;
|
|
15
|
+
padding: 15px 25px;
|
|
16
|
+
font-size: 16px;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
background: #0e639c;
|
|
19
|
+
color: white;
|
|
20
|
+
border: none;
|
|
21
|
+
border-radius: 4px;
|
|
22
|
+
}
|
|
23
|
+
button:hover { background: #1177bb; }
|
|
24
|
+
.result {
|
|
25
|
+
margin: 10px 0;
|
|
26
|
+
padding: 15px;
|
|
27
|
+
background: #252526;
|
|
28
|
+
border-left: 3px solid #4ec9b0;
|
|
29
|
+
font-size: 14px;
|
|
30
|
+
}
|
|
31
|
+
.error { border-left-color: #f48771; }
|
|
32
|
+
.warning { border-left-color: #dcdcaa; }
|
|
33
|
+
</style>
|
|
34
|
+
</head>
|
|
35
|
+
<body>
|
|
36
|
+
<h1>IPC Reachability Test</h1>
|
|
37
|
+
<p style="color: #ce9178;">Testing if messages can reach Rust handlers...</p>
|
|
38
|
+
|
|
39
|
+
<h2>Test 1: Simple IPC Test (No Window Operation)</h2>
|
|
40
|
+
<button onclick="testSimpleIPC()">Send Test IPC Message</button>
|
|
41
|
+
<div id="result1" class="result">Click button to test</div>
|
|
42
|
+
|
|
43
|
+
<h2>Test 2: Window Operation (setTitle)</h2>
|
|
44
|
+
<p style="font-size: 12px;">⚠️ This may crash if catch_unwind doesn't work</p>
|
|
45
|
+
<button onclick="testSetTitle()">Try Set Window Title</button>
|
|
46
|
+
<div id="result2" class="result">Click button to test</div>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
function log(id, msg, type = 'result') {
|
|
50
|
+
const el = document.getElementById(id);
|
|
51
|
+
el.className = type;
|
|
52
|
+
el.textContent = `[${new Date().toLocaleTimeString()}] ${msg}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function testSimpleIPC() {
|
|
56
|
+
try {
|
|
57
|
+
log('result1', 'Sending test IPC message...', 'warning');
|
|
58
|
+
const result = msger.testIPC();
|
|
59
|
+
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
if (result) {
|
|
62
|
+
log('result1', `✅ IPC message sent successfully! Result: ${result}\n\nCheck console for "DEBUG: Test IPC message received"`, 'result');
|
|
63
|
+
} else {
|
|
64
|
+
log('result1', `❌ IPC failed to send. Result: ${result}`, 'error');
|
|
65
|
+
}
|
|
66
|
+
}, 100);
|
|
67
|
+
} catch(e) {
|
|
68
|
+
log('result1', `❌ ERROR: ${e.message}`, 'error');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function testSetTitle() {
|
|
73
|
+
try {
|
|
74
|
+
log('result2', '⚠️ Attempting window operation via IPC...', 'warning');
|
|
75
|
+
|
|
76
|
+
// Use the test function we added
|
|
77
|
+
const result = msger._testSetTitle('🧪 IPC TEST - Title Changed!');
|
|
78
|
+
|
|
79
|
+
setTimeout(() => {
|
|
80
|
+
if (result) {
|
|
81
|
+
log('result2', `✅ Message sent! If title changed and no crash, IPC WORKS!\n\nCheck:\n1. Window title\n2. Console for DEBUG messages\n3. stderr for Rust logs`, 'result');
|
|
82
|
+
} else {
|
|
83
|
+
log('result2', `❌ IPC failed. Result: ${result}`, 'error');
|
|
84
|
+
}
|
|
85
|
+
}, 100);
|
|
86
|
+
} catch(e) {
|
|
87
|
+
log('result2', `❌ ERROR: ${e.message}\n\nIf app crashed, catch_unwind didn't work.`, 'error');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Auto-run simple test on load
|
|
92
|
+
window.addEventListener('load', function() {
|
|
93
|
+
setTimeout(() => {
|
|
94
|
+
log('result1', 'Ready - Click to send test IPC message', 'warning');
|
|
95
|
+
log('result2', 'Ready - Click to test window operation', 'warning');
|
|
96
|
+
|
|
97
|
+
// Check if test functions exist
|
|
98
|
+
if (typeof msger.testIPC === 'function') {
|
|
99
|
+
console.log('✅ msger.testIPC exists');
|
|
100
|
+
} else {
|
|
101
|
+
console.error('❌ msger.testIPC NOT FOUND');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (typeof msger._testSetTitle === 'function') {
|
|
105
|
+
console.log('✅ msger._testSetTitle exists');
|
|
106
|
+
} else {
|
|
107
|
+
console.error('❌ msger._testSetTitle NOT FOUND');
|
|
108
|
+
}
|
|
109
|
+
}, 500);
|
|
110
|
+
});
|
|
111
|
+
</script>
|
|
112
|
+
</body>
|
|
113
|
+
</html>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>msger API Test</title>
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
9
|
+
padding: 20px;
|
|
10
|
+
max-width: 800px;
|
|
11
|
+
margin: 0 auto;
|
|
12
|
+
}
|
|
13
|
+
h1 {
|
|
14
|
+
color: #333;
|
|
15
|
+
}
|
|
16
|
+
.section {
|
|
17
|
+
margin: 20px 0;
|
|
18
|
+
padding: 15px;
|
|
19
|
+
border: 1px solid #ddd;
|
|
20
|
+
border-radius: 8px;
|
|
21
|
+
background: #f9f9f9;
|
|
22
|
+
}
|
|
23
|
+
button {
|
|
24
|
+
margin: 5px;
|
|
25
|
+
padding: 10px 15px;
|
|
26
|
+
background: #0066cc;
|
|
27
|
+
color: white;
|
|
28
|
+
border: none;
|
|
29
|
+
border-radius: 4px;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
button:hover {
|
|
33
|
+
background: #0052a3;
|
|
34
|
+
}
|
|
35
|
+
input, textarea {
|
|
36
|
+
padding: 8px;
|
|
37
|
+
margin: 5px;
|
|
38
|
+
border: 1px solid #ccc;
|
|
39
|
+
border-radius: 4px;
|
|
40
|
+
}
|
|
41
|
+
.output {
|
|
42
|
+
margin-top: 10px;
|
|
43
|
+
padding: 10px;
|
|
44
|
+
background: #fff;
|
|
45
|
+
border: 1px solid #ccc;
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
font-family: monospace;
|
|
48
|
+
}
|
|
49
|
+
</style>
|
|
50
|
+
</head>
|
|
51
|
+
<body>
|
|
52
|
+
<h1>msger JavaScript API Test</h1>
|
|
53
|
+
|
|
54
|
+
<div class="section">
|
|
55
|
+
<h2>Window Control</h2>
|
|
56
|
+
<button onclick="msger.toggleFullscreen()">Toggle Fullscreen</button>
|
|
57
|
+
<button onclick="msger.minimize()">Minimize</button>
|
|
58
|
+
<button onclick="msger.maximize()">Maximize/Restore</button>
|
|
59
|
+
<button onclick="msger.setAlwaysOnTop(true)">Always On Top</button>
|
|
60
|
+
<button onclick="msger.setAlwaysOnTop(false)">Not Always On Top</button>
|
|
61
|
+
<br>
|
|
62
|
+
<button onclick="msger.setTitle('New Title!')">Set Title</button>
|
|
63
|
+
<button onclick="msger.setSize(600, 400)">Set Size 600x400</button>
|
|
64
|
+
<button onclick="msger.setSize(1000, 600)">Set Size 1000x600</button>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div class="section">
|
|
68
|
+
<h2>Data Persistence</h2>
|
|
69
|
+
<input type="text" id="dataKey" placeholder="Key" value="testKey">
|
|
70
|
+
<input type="text" id="dataValue" placeholder="Value" value="Hello World">
|
|
71
|
+
<button onclick="saveTestData()">Save Data</button>
|
|
72
|
+
<button onclick="loadTestData()">Load Data</button>
|
|
73
|
+
<button onclick="removeTestData()">Remove Data</button>
|
|
74
|
+
<button onclick="clearAllData()">Clear All msger Data</button>
|
|
75
|
+
<div id="dataOutput" class="output"></div>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div class="section">
|
|
79
|
+
<h2>Close Window</h2>
|
|
80
|
+
<button onclick="msger.close()">Close (dismissed)</button>
|
|
81
|
+
<button onclick="msger.close({button: 'OK', value: 'custom result'})">Close with Result</button>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<script>
|
|
85
|
+
function saveTestData() {
|
|
86
|
+
const key = document.getElementById('dataKey').value;
|
|
87
|
+
const value = document.getElementById('dataValue').value;
|
|
88
|
+
const result = msger.saveData(key, value);
|
|
89
|
+
document.getElementById('dataOutput').textContent =
|
|
90
|
+
`Saved: ${result ? 'Success' : 'Failed'}`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function loadTestData() {
|
|
94
|
+
const key = document.getElementById('dataKey').value;
|
|
95
|
+
const value = msger.loadData(key, 'Not found');
|
|
96
|
+
document.getElementById('dataOutput').textContent =
|
|
97
|
+
`Loaded: ${JSON.stringify(value)}`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function removeTestData() {
|
|
101
|
+
const key = document.getElementById('dataKey').value;
|
|
102
|
+
const result = msger.removeData(key);
|
|
103
|
+
document.getElementById('dataOutput').textContent =
|
|
104
|
+
`Removed: ${result ? 'Success' : 'Failed'}`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function clearAllData() {
|
|
108
|
+
const result = msger.clearData();
|
|
109
|
+
document.getElementById('dataOutput').textContent =
|
|
110
|
+
`Cleared all: ${result ? 'Success' : 'Failed'}`;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Show that msger API is available
|
|
114
|
+
window.addEventListener('load', function() {
|
|
115
|
+
console.log('msger API available:', typeof msger !== 'undefined');
|
|
116
|
+
console.log('msger methods:', Object.keys(msger));
|
|
117
|
+
});
|
|
118
|
+
</script>
|
|
119
|
+
</body>
|
|
120
|
+
</html>
|