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({
|
||||
id : "7chname",
|
||||
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},
|
||||
]
|
||||
});
|
||||
|
@ -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)
|
||||
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 that create data that can be read back can define a `interface` element in `apps.json`,
|
||||
|
|
|
@ -199,7 +199,7 @@ g.clear();`;
|
|||
|
||||
sendCustomizedApp({
|
||||
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({
|
||||
storage:[
|
||||
{name:"espruinoctrl.app.js", content:app},
|
||||
{name:"espruinoctrl.app.js", url:"app.js", content:app},
|
||||
]
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody id="products">
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br><br>
|
||||
|
@ -34,7 +34,7 @@
|
|||
</form>
|
||||
<br><br>
|
||||
<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>
|
||||
|
@ -53,15 +53,15 @@
|
|||
var $reset = document.getElementById('reset')
|
||||
|
||||
renderProducts()
|
||||
|
||||
|
||||
$reset.addEventListener('click', reset)
|
||||
|
||||
$form.addEventListener('submit', event => {
|
||||
event.preventDefault()
|
||||
|
||||
|
||||
var name = $name.value.trim()
|
||||
if(!name) return;
|
||||
|
||||
|
||||
var quantity = parseInt($quantity.value)
|
||||
|
||||
products.push({
|
||||
|
@ -95,13 +95,13 @@
|
|||
$list.innerHTML = ''
|
||||
products.forEach((product,index) => {
|
||||
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>`
|
||||
$list.appendChild($product)
|
||||
})
|
||||
|
||||
$name.focus()
|
||||
|
||||
|
||||
}
|
||||
|
||||
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="))`;
|
||||
sendCustomizedApp({
|
||||
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"}
|
||||
]
|
||||
|
|
|
@ -210,7 +210,7 @@ exports = {
|
|||
console.log("Locale Module is:",localeModule);
|
||||
sendCustomizedApp({
|
||||
storage:[
|
||||
{name:"locale", content:localeModule}
|
||||
{name:"locale", url:"locale.js", content:localeModule}
|
||||
]
|
||||
});
|
||||
});
|
||||
|
|
|
@ -216,7 +216,7 @@ g.clear();`;
|
|||
|
||||
sendCustomizedApp({
|
||||
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({
|
||||
storage:[
|
||||
{name:"qrcode.app.js", content:app},
|
||||
{name:"qrcode.app.js", url:"app.js", content:app},
|
||||
]
|
||||
});
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ g.clear();
|
|||
|
||||
sendCustomizedApp({
|
||||
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