-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9570b8c
commit 2d2727e
Showing
8 changed files
with
583 additions
and
458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
> | ||
<Deployment.Parts> | ||
</Deployment.Parts> | ||
<Deployment.Parts> | ||
</Deployment.Parts> | ||
</Deployment> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
|
||
/****************************** DEBUGCONSOLE ******************************/ | ||
|
||
/** | ||
* This class provides access to the debugging console. | ||
* @constructor | ||
*/ | ||
function DebugConsole() { | ||
} | ||
|
||
/** | ||
* Utility function for rendering and indenting strings, or serializing | ||
* objects to a string capable of being printed to the console. | ||
* @param {Object|String} message The string or object to convert to an indented string | ||
* @private | ||
*/ | ||
DebugConsole.prototype.processMessage = function(message) { | ||
if (typeof(message) != 'object') { | ||
return message; | ||
} else { | ||
/** | ||
* @function | ||
* @ignore | ||
*/ | ||
function indent(str) { | ||
return str.replace(/^/mg, " "); | ||
} | ||
/** | ||
* @function | ||
* @ignore | ||
*/ | ||
function makeStructured(obj) { | ||
var str = ""; | ||
for (var i in obj) { | ||
try { | ||
if (typeof(obj[i]) == 'object') { | ||
str += i + ":\n" + indent(makeStructured(obj[i])) + "\n"; | ||
} else { | ||
str += i + " = " + indent(String(obj[i])).replace(/^ /, "") + "\n"; | ||
} | ||
} catch(e) { | ||
str += i + " = EXCEPTION: " + e.message + "\n"; | ||
} | ||
} | ||
return str; | ||
} | ||
return "Object:\n" + makeStructured(message); | ||
} | ||
}; | ||
|
||
/** | ||
* Print a normal log message to the console | ||
* @param {Object|String} message Message or object to print to the console | ||
*/ | ||
DebugConsole.prototype.log = function(message) { | ||
if (PhoneGap.available) { | ||
PhoneGap.exec('DebugConsole;INFO;' + this.processMessage(message)); | ||
} | ||
}; | ||
|
||
DebugConsole.prototype.log = function(message) | ||
{ | ||
if (PhoneGap.available && this.logLevel <= DebugConsole.INFO_LEVEL) | ||
{ | ||
PhoneGap.exec(null, null, 'com.phonegap.debugconsole', 'log', message); | ||
} | ||
else | ||
{ | ||
this.winConsole.log(message); | ||
} | ||
}; | ||
|
||
/** | ||
* Print a warning message to the console | ||
* @param {Object|String} message Message or object to print to the console | ||
*/ | ||
DebugConsole.prototype.warn = function(message) { | ||
if (PhoneGap.available) { | ||
PhoneGap.exec('DebugConsole;WARN;' + this.processMessage(message)); | ||
} | ||
}; | ||
|
||
/** | ||
* Print an error message to the console | ||
* @param {Object|String} message Message or object to print to the console | ||
*/ | ||
DebugConsole.prototype.error = function(message) { | ||
if (PhoneGap.available) { | ||
PhoneGap.exec('DebugConsole;ERROR;' + this.processMessage(message)); | ||
} | ||
}; | ||
|
||
if (typeof window.debug == "undefined") { | ||
window.debug = new DebugConsole(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,93 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="mobileoptimized" content="800" /> | ||
<meta name="viewport" content="user-scalable=no" /> | ||
|
||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=9" /> | ||
<meta name="Viewport" content="width=480" /> | ||
<meta http-equiv="Expires" content="0" /> | ||
|
||
<title>PhoneGap - WP7 : Proof of concept</title> | ||
<link rel="stylesheet" type="text/css" href="master.css"/> | ||
|
||
<script type="text/javascript" charset="utf-8" src="phonegap-base.js"></script> | ||
<script type="text/javascript" charset="utf-8"> | ||
|
||
if(typeof window.console == "undefined") | ||
{ | ||
window.console = {log:function(str){window.external.Notify(str);}}; | ||
} | ||
|
||
<script> | ||
|
||
function onLoad() | ||
{ | ||
console.log("loaded"); | ||
} | ||
</script> | ||
window.onerror=function(e){console.log("Error ::" + e);}; | ||
|
||
console.log("Installed console ! "); | ||
|
||
</head> | ||
<body onload="onLoad"> | ||
//forceError(); | ||
|
||
|
||
//document.writeln(getScript("Accelerometer")); | ||
|
||
function JavaScriptFunctionWithoutParameters() | ||
{ | ||
outputID.innerHTML = "JavaScript function called!"; | ||
return "hey"; | ||
} | ||
|
||
function makeError() | ||
{ | ||
forceError(); // forceError does not exist | ||
} | ||
|
||
//console.log("JSON = " + JSON); | ||
|
||
function doLoad() | ||
{ | ||
|
||
|
||
//console.log("OnLoad"); | ||
|
||
|
||
console.log("document.addEventListener = " + document.addEventListener); | ||
|
||
<div>Hmmm</div> | ||
} | ||
|
||
var NextcallbackId = 0; | ||
var callbacks = {}; | ||
var exec = function(success, fail, service, action, args) | ||
{ | ||
|
||
var callbackId = service + NextcallbackId++; | ||
if (typeof success == "Function" || typeof fail == "Function") | ||
{ | ||
callbacks[callbackId] = {success:success, fail:fail}; | ||
} | ||
|
||
var command = service + "/" + action + "/" + callbackId + "/" + JSON.stringify(args); | ||
|
||
window.external.Notify(command); | ||
} | ||
|
||
|
||
exec(null,null,"DebugConsole","log",{message:"This is message 1"}); | ||
exec(null,null,"DebugConsole","log",{message:"This is message 2"}); | ||
exec(null,null,"DebugConsole","log",{message:"This is message 3"}); | ||
|
||
exec(null,null,"Notification","alert","here is a freakin message"); | ||
exec(null,null,"Notification","confirm","here is a freakin message"); | ||
|
||
</script> | ||
|
||
</head> | ||
<body onload="doLoad()"> | ||
<div id="dude">Hmmm</div> | ||
|
||
<!-- This image has been included to prove it can be done --> | ||
<img alt="PhoneGap" src="pg_logo.png" /> | ||
<img alt="PhoneGap" src="pg_logo.png" id="gapImage" /> | ||
|
||
<div id="outputID" style="color:Orange; font-size:16"> | ||
Hello from HTML document pre script! | ||
</div> | ||
|
||
|
||
</body> | ||
</html> |
Oops, something went wrong.