mirror of https://github.com/espruino/BangleApps
Allow customised apps to be minified/pretokenised
parent
30953ff720
commit
8ad5d13516
|
@ -291,7 +291,7 @@ version of what's in `apps.json`:
|
||||||
sendCustomizedApp({
|
sendCustomizedApp({
|
||||||
id : "7chname",
|
id : "7chname",
|
||||||
storage:[
|
storage:[
|
||||||
{name:"7chname.app.js", content:app_source_code},
|
{name:"7chname.app.js", url:"app.js", content:app_source_code},
|
||||||
{name:"7chname.img", content:'require("heatshrink").decompress(atob("mEwg...4"))', evaluate:true},
|
{name:"7chname.img", content:'require("heatshrink").decompress(atob("mEwg...4"))', evaluate:true},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
@ -304,6 +304,10 @@ version of what's in `apps.json`:
|
||||||
This'll then be loaded in to the watch. See [apps/qrcode/grcode.html](the QR Code app)
|
This'll then be loaded in to the watch. See [apps/qrcode/grcode.html](the QR Code app)
|
||||||
for a clean example.
|
for a clean example.
|
||||||
|
|
||||||
|
**Note:** we specify a `url` for JS files even though it doesn't have to exist
|
||||||
|
and will never be loaded. This is so the app loader can tell if it's a JavaScript
|
||||||
|
file based on the extension, and if so it can minify and pretokenise it.
|
||||||
|
|
||||||
### `apps.json`: `interface` element
|
### `apps.json`: `interface` element
|
||||||
|
|
||||||
Apps that create data that can be read back can define a `interface` element in `apps.json`,
|
Apps that create data that can be read back can define a `interface` element in `apps.json`,
|
||||||
|
|
|
@ -199,7 +199,7 @@ g.clear();`;
|
||||||
|
|
||||||
sendCustomizedApp({
|
sendCustomizedApp({
|
||||||
storage:[
|
storage:[
|
||||||
{name:"beer.app.js", content:app}
|
{name:"beer.app.js", url:"app.js", content:app}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -266,7 +266,7 @@ function sendCommand(device, text, callback) {
|
||||||
`;
|
`;
|
||||||
sendCustomizedApp({
|
sendCustomizedApp({
|
||||||
storage:[
|
storage:[
|
||||||
{name:"espruinoctrl.app.js", content:app},
|
{name:"espruinoctrl.app.js", url:"app.js", content:app},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="products">
|
<tbody id="products">
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
</form>
|
</form>
|
||||||
<br><br>
|
<br><br>
|
||||||
<button id="reset" class="btn btn-error">Reset</button> <button id="upload" class="btn btn-primary">Upload</button>
|
<button id="reset" class="btn btn-error">Reset</button> <button id="upload" class="btn btn-primary">Upload</button>
|
||||||
|
|
||||||
<script src="../../core/lib/customize.js"></script>
|
<script src="../../core/lib/customize.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -53,15 +53,15 @@
|
||||||
var $reset = document.getElementById('reset')
|
var $reset = document.getElementById('reset')
|
||||||
|
|
||||||
renderProducts()
|
renderProducts()
|
||||||
|
|
||||||
$reset.addEventListener('click', reset)
|
$reset.addEventListener('click', reset)
|
||||||
|
|
||||||
$form.addEventListener('submit', event => {
|
$form.addEventListener('submit', event => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
var name = $name.value.trim()
|
var name = $name.value.trim()
|
||||||
if(!name) return;
|
if(!name) return;
|
||||||
|
|
||||||
var quantity = parseInt($quantity.value)
|
var quantity = parseInt($quantity.value)
|
||||||
|
|
||||||
products.push({
|
products.push({
|
||||||
|
@ -95,13 +95,13 @@
|
||||||
$list.innerHTML = ''
|
$list.innerHTML = ''
|
||||||
products.forEach((product,index) => {
|
products.forEach((product,index) => {
|
||||||
var $product = document.createElement('tr')
|
var $product = document.createElement('tr')
|
||||||
|
|
||||||
$product.innerHTML = `<td>${product.name}</td><td>${product.quantity}</td><td><button class="btn btn-error" onclick="removeProduct(${index})">remove</button></td>`
|
$product.innerHTML = `<td>${product.name}</td><td>${product.quantity}</td><td><button class="btn btn-error" onclick="removeProduct(${index})">remove</button></td>`
|
||||||
$list.appendChild($product)
|
$list.appendChild($product)
|
||||||
})
|
})
|
||||||
|
|
||||||
$name.focus()
|
$name.focus()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById("upload").addEventListener("click", function() {
|
document.getElementById("upload").addEventListener("click", function() {
|
||||||
|
@ -152,7 +152,7 @@ E.showMenu(mainMenu);
|
||||||
var icon = `require("heatshrink").decompress(atob("mEwxH+AH4A/AH4AQ0QACF1nGAAIxpFoYwqFwwwnRggwGB4eFAggACLzwHCMAeF1WGAgOGw2x2IGCLzYGEF4YpBwotCFwJfWFwo1GSAYtBAIIABRq4vFMhAwBzoAFdzIuKAAOc4IAGGC4qEMZOiF44wXFxovleBYvIGCwmB0WjE4V/AgfG1IvCzujFQOjwoECF6WFwovBDYOFEwN/AgIwCAgOFBwYrBBAQEBzodCF6AAHww1CBpIODAAYvRDAWG2IEBAYYJFBxICCF6Ox1WxAAQfBAYQlCAAIOJAQIvUADQvn1WGR4RfbP4gAFBwgFCF7a5EdwQADF46/cL9wAQF94AGF85bB1TvmF47vdJ4bvFF8qPRFgLv/L7jPCaQq/fYYrvgJgoAGd/7v/F/4v/F5oAdF54weFyAA/AH4A3A="))`;
|
var icon = `require("heatshrink").decompress(atob("mEwxH+AH4A/AH4AQ0QACF1nGAAIxpFoYwqFwwwnRggwGB4eFAggACLzwHCMAeF1WGAgOGw2x2IGCLzYGEF4YpBwotCFwJfWFwo1GSAYtBAIIABRq4vFMhAwBzoAFdzIuKAAOc4IAGGC4qEMZOiF44wXFxovleBYvIGCwmB0WjE4V/AgfG1IvCzujFQOjwoECF6WFwovBDYOFEwN/AgIwCAgOFBwYrBBAQEBzodCF6AAHww1CBpIODAAYvRDAWG2IEBAYYJFBxICCF6Ox1WxAAQfBAYQlCAAIOJAQIvUADQvn1WGR4RfbP4gAFBwgFCF7a5EdwQADF46/cL9wAQF94AGF85bB1TvmF47vdJ4bvFF8qPRFgLv/L7jPCaQq/fYYrvgJgoAGd/7v/F/4v/F5oAdF54weFyAA/AH4A3A="))`;
|
||||||
sendCustomizedApp({
|
sendCustomizedApp({
|
||||||
storage:[
|
storage:[
|
||||||
{name:"grocery.app.js", content:app},
|
{name:"grocery.app.js", url:"app.js", content:app},
|
||||||
{name:"grocery.img", content:icon, evaluate:true},
|
{name:"grocery.img", content:icon, evaluate:true},
|
||||||
{name:"grocery"}
|
{name:"grocery"}
|
||||||
]
|
]
|
||||||
|
|
|
@ -210,7 +210,7 @@ exports = {
|
||||||
console.log("Locale Module is:",localeModule);
|
console.log("Locale Module is:",localeModule);
|
||||||
sendCustomizedApp({
|
sendCustomizedApp({
|
||||||
storage:[
|
storage:[
|
||||||
{name:"locale", content:localeModule}
|
{name:"locale", url:"locale.js", content:localeModule}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -216,7 +216,7 @@ g.clear();`;
|
||||||
|
|
||||||
sendCustomizedApp({
|
sendCustomizedApp({
|
||||||
storage:[
|
storage:[
|
||||||
{name:"osmpoi.app.js", content:app}
|
{name:"osmpoi.app.js", url:"app.js", content:app}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -104,7 +104,7 @@ g.setColor(1,1,1);
|
||||||
`;
|
`;
|
||||||
sendCustomizedApp({
|
sendCustomizedApp({
|
||||||
storage:[
|
storage:[
|
||||||
{name:"qrcode.app.js", content:app},
|
{name:"qrcode.app.js", url:"app.js", content:app},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ g.clear();
|
||||||
|
|
||||||
sendCustomizedApp({
|
sendCustomizedApp({
|
||||||
storage:[
|
storage:[
|
||||||
{name:"route.app.js", content:app}
|
{name:"route.app.js", url:"app.js", content:app}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
2
core
2
core
|
@ -1 +1 @@
|
||||||
Subproject commit 20a09f4f225ad0edae5e9b52b98900ebe8ef97cc
|
Subproject commit 9708e1a15ee20734a24f6f2913078aa8bba625dc
|
Loading…
Reference in New Issue