Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial Commit

  • Loading branch information...
commit 1dd6033a307662929959271ae25a24b7fb15470d 0 parents
@creationix authored
9 appinfo.json
@@ -0,0 +1,9 @@
+{
+ "id": "com.creationix.colorspin",
+ "version": "1.0.0",
+ "vendor": "Tim Caswell",
+ "type": "web",
+ "main": "index.html",
+ "title": "ColorSpin",
+ "icon": "icon.png"
+}
24 colorspin.js
@@ -0,0 +1,24 @@
+window.addEventListener('load', function () {
+ var body = document.querySelector('body');
+ function setHue(hue) {
+ body.style.backgroundColor="hsl(" + hue + ",100%,50%)";
+ }
+
+ if (typeof PalmSystem !== 'undefined') {
+ // on real device
+ PalmSystem.stageReady();
+ PalmSystem.enableFullScreenMode(true);
+ window.addEventListener('acceleration', function (evt) {
+ var hue = (evt.accelX * -180 + 900) % 360;
+ setHue(hue);
+ console.log(("X: " + evt.accelX + "; Y:" + evt.accelY + "; Z:" + evt.accelZ + "; time: " + evt.time));
+ }, true);
+ } else {
+ // Running in desktop browser
+ setInterval(function () {
+ setHue(Math.random() * 360);
+ }, 500);
+ }
+
+});
+
BIN  icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 index.html
@@ -0,0 +1,40 @@
+<!doctype html>
+<html>
+<head>
+ <title>ColorSpin</title>
+ <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no"/>
+ <style>
+ html { height: 100%; }
+ body {
+ height: 100%;
+ margin: 0;
+ -webkit-transition: background-color 0.25s linear;
+ background-color: hsl(255,100%,50%);
+ }
+ </style>
+ <script>
+ window.addEventListener('load', function () {
+ var body = document.querySelector('body');
+ function setHue(hue) {
+ body.style.backgroundColor="hsl(" + hue + ",100%,50%)";
+ }
+ if (typeof PalmSystem !== 'undefined') {
+ // on real device
+ PalmSystem.stageReady();
+ PalmSystem.enableFullScreenMode(true);
+ window.addEventListener('acceleration', function (evt) {
+ var hue = (evt.accelX * -180 + 900) % 360;
+ setHue(hue);
+ }, true);
+ } else {
+ // Running in desktop browser
+ setInterval(function () {
+ setHue(Math.random() * 360);
+ }, 500);
+ }
+ });
+ </script>
+</head>
+<body>
+</body>
+</html>
5 launch.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+palm-package .
+palm-install *.ipk
+palm-launch com.creationix.colors
+rm *.ipk
23 req.js
@@ -0,0 +1,23 @@
+// Simple wrapper to make PamlBus requests.
+function palmRequest(url, params, callback) {
+ var req = new PalmServiceBridge();
+ req.onservicecallback = function (result) {
+ var data;
+ try {
+ data = JSON.parse(result);
+ } catch (err) {
+ callback(err);
+ return;
+ }
+ callback(null, data);
+ };
+ req.call(url, JSON.stringify(params));
+}
+
+
+palmRequest("palm://com.palm.location/getCurrentPosition", { accuracy: 1, maximumAge: 0, responseTime: 3 }, function (err, data) {
+ console.log("Final");
+ if (err) { throw err; }
+ console.log(JSON.stringify(data));
+});
+
Please sign in to comment.
Something went wrong with that request. Please try again.