cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hermw...@apache.org
Subject webos commit: updates to cordova.js - added pause/resume document events to sysmgr calls, online/offline document events mapped to network connection service. switched from strings to constants in connection for connection type
Date Thu, 29 Nov 2012 00:32:31 GMT
Updated Branches:
  refs/heads/master e3e462535 -> 50928b795


updates to cordova.js - added pause/resume document events to sysmgr calls, online/offline
document events mapped to network connection service. switched from strings to constants in
connection for connection type


Project: http://git-wip-us.apache.org/repos/asf/cordova-webos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-webos/commit/50928b79
Tree: http://git-wip-us.apache.org/repos/asf/cordova-webos/tree/50928b79
Diff: http://git-wip-us.apache.org/repos/asf/cordova-webos/diff/50928b79

Branch: refs/heads/master
Commit: 50928b795a62f0a95f530770af2f20a6784d7a82
Parents: e3e4625
Author: hermwong <herm.wong@gmail.com>
Authored: Wed Nov 28 16:32:18 2012 -0800
Committer: hermwong <herm.wong@gmail.com>
Committed: Wed Nov 28 16:32:18 2012 -0800

----------------------------------------------------------------------
 lib/cordova.webos-debug.js |    8 ++--
 lib/cordova.webos.js       |   77 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 71 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-webos/blob/50928b79/lib/cordova.webos-debug.js
----------------------------------------------------------------------
diff --git a/lib/cordova.webos-debug.js b/lib/cordova.webos-debug.js
index 869ed94..8946918 100644
--- a/lib/cordova.webos-debug.js
+++ b/lib/cordova.webos-debug.js
@@ -1,6 +1,6 @@
-// commit c46b14085ce80cda5f72d6af22bc22afe4c2151d
+// commit 0a4e6fd7f89ad229ed98a4222e83634d5cf7968d
 
-// File generated at :: Tue Nov 27 2012 15:33:15 GMT-0800 (PST)
+// File generated at :: Wed Nov 28 2012 16:21:57 GMT-0800 (PST)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -31,7 +31,7 @@ try {eval("define(\"cordova/channel\", function(require, exports, module)
{\n\nv
 try {eval("define(\"cordova/commandProxy\", function(require, exports, module) {\n\n\n//
internal map of proxy function\nvar CommandProxyMap = {};\n\nmodule.exports = {\n\n    //
example: cordova.commandProxy.add(\"Accelerometer\",{getCurrentAcceleration: function(successCallback,
errorCallback, options) {...},...);\n    add:function(id,proxyObj) {\n        console.log(\"adding
proxy for \" + id);\n        CommandProxyMap[id] = proxyObj;\n        return proxyObj;\n 
  },\n\n    // cordova.commandProxy.remove(\"Accelerometer\");\n    remove:function(id) {\n
       var proxy = CommandProxyMap[id];\n        delete CommandProxyMap[id];\n        CommandProxyMap[id]
= null;\n        return proxy;\n    },\n\n    get:function(service,action) {\n        return
( CommandProxyMap[service] ? CommandProxyMap[service][action] : null );\n    }\n};\n});\n\n//@
sourceURL=lib/common/commandProxy.js")} catch(e) {console.log("exception: in lib/common/commandProxy.js:
" + e);console.log(e.stack);}
 try {eval("define(\"cordova/common\", function(require, exports, module) {\n\nmodule.exports
= {\n    defaults: {\n        cordova: {\n            path: 'cordova',\n            children:
{\n                exec: {\n                    path: 'cordova/exec'\n                },\n
               logger: {\n                    path: 'cordova/plugin/logger'\n            
   }\n            }\n        },\n        Cordova: {\n            children: {\n           
    exec: {\n                    path: 'cordova/exec'\n                }\n            }\n
       },\n        open : {\n            path: 'cordova/plugin/InAppBrowser'\n        },\n
       navigator: {\n            children: {\n                notification: {\n          
         path: 'cordova/plugin/notification'\n                },\n                accelerometer:
{\n                    path: 'cordova/plugin/accelerometer'\n                },\n        
       battery: {\n                    path: 'cordova/plugin/battery'\n          
       },\n                camera:{\n                    path: 'cordova/plugin/Camera'\n 
              },\n                compass:{\n                    path: 'cordova/plugin/compass'\n
               },\n                contacts: {\n                    path: 'cordova/plugin/contacts'\n
               },\n                device:{\n                    children:{\n            
           capture: {\n                            path: 'cordova/plugin/capture'\n      
                 }\n                    }\n                },\n                geolocation:
{\n                    path: 'cordova/plugin/geolocation'\n                },\n          
     globalization: {\n                    path: 'cordova/plugin/globalization'\n        
       },\n                network: {\n                    children: {\n                 
      connection: {\n                            path: 'cordova/plugin/network',\n       
                    deprecated: 'navigator.network.connection is deprecated.
  Use navigator.connection instead.'\n                        }\n                    }\n 
              },\n                splashscreen: {\n                    path: 'cordova/plugin/splashscreen'\n
               }\n            }\n        },\n        Acceleration: {\n            path: 'cordova/plugin/Acceleration'\n
       },\n        Camera:{\n            path: 'cordova/plugin/CameraConstants'\n        },\n
       CameraPopoverOptions: {\n            path: 'cordova/plugin/CameraPopoverOptions'\n
       },\n        CaptureError: {\n            path: 'cordova/plugin/CaptureError'\n    
   },\n        CaptureAudioOptions:{\n            path: 'cordova/plugin/CaptureAudioOptions'\n
       },\n        CaptureImageOptions: {\n            path: 'cordova/plugin/CaptureImageOptions'\n
       },\n        CaptureVideoOptions: {\n            path: 'cordova/plugin/CaptureVideoOptions'\n
       },\n        CompassHeading:{\n            path: 'cordova/plugin/CompassHeading'\n 
      },\n        Co
 mpassError:{\n            path: 'cordova/plugin/CompassError'\n        },\n        ConfigurationData:
{\n            path: 'cordova/plugin/ConfigurationData'\n        },\n        Connection: {\n
           path: 'cordova/plugin/Connection'\n        },\n        Contact: {\n           
path: 'cordova/plugin/Contact'\n        },\n        ContactAddress: {\n            path: 'cordova/plugin/ContactAddress'\n
       },\n        ContactError: {\n            path: 'cordova/plugin/ContactError'\n    
   },\n        ContactField: {\n            path: 'cordova/plugin/ContactField'\n        },\n
       ContactFindOptions: {\n            path: 'cordova/plugin/ContactFindOptions'\n    
   },\n        ContactName: {\n            path: 'cordova/plugin/ContactName'\n        },\n
       ContactOrganization: {\n            path: 'cordova/plugin/ContactOrganization'\n  
     },\n        Coordinates: {\n            path: 'cordova/plugin/Coordinates'\n        },\n
       device: {\n            path: 'co
 rdova/plugin/device'\n        },\n        DirectoryEntry: {\n            path: 'cordova/plugin/DirectoryEntry'\n
       },\n        DirectoryReader: {\n            path: 'cordova/plugin/DirectoryReader'\n
       },\n        Entry: {\n            path: 'cordova/plugin/Entry'\n        },\n      
 File: {\n            path: 'cordova/plugin/File'\n        },\n        FileEntry: {\n    
       path: 'cordova/plugin/FileEntry'\n        },\n        FileError: {\n            path:
'cordova/plugin/FileError'\n        },\n        FileReader: {\n            path: 'cordova/plugin/FileReader'\n
       },\n        FileSystem: {\n            path: 'cordova/plugin/FileSystem'\n        },\n
       FileTransfer: {\n            path: 'cordova/plugin/FileTransfer'\n        },\n    
   FileTransferError: {\n            path: 'cordova/plugin/FileTransferError'\n        },\n
       FileUploadOptions: {\n            path: 'cordova/plugin/FileUploadOptions'\n      
 },\n        FileUploadResult: {\n        
     path: 'cordova/plugin/FileUploadResult'\n        },\n        FileWriter: {\n        
   path: 'cordova/plugin/FileWriter'\n        },\n        Flags: {\n            path: 'cordova/plugin/Flags'\n
       },\n        GlobalizationError: {\n            path: 'cordova/plugin/GlobalizationError'\n
       },\n        LocalFileSystem: {\n            path: 'cordova/plugin/LocalFileSystem'\n
       },\n        Media: {\n            path: 'cordova/plugin/Media'\n        },\n      
 MediaError: {\n            path: 'cordova/plugin/MediaError'\n        },\n        MediaFile:
{\n            path: 'cordova/plugin/MediaFile'\n        },\n        MediaFileData:{\n   
        path: 'cordova/plugin/MediaFileData'\n        },\n        Metadata:{\n           
path: 'cordova/plugin/Metadata'\n        },\n        Position: {\n            path: 'cordova/plugin/Position'\n
       },\n        PositionError: {\n            path: 'cordova/plugin/PositionError'\n  
     },\n        ProgressEvent: {\n      
       path: 'cordova/plugin/ProgressEvent'\n        },\n        requestFileSystem:{\n   
        path: 'cordova/plugin/requestFileSystem'\n        },\n        resolveLocalFileSystemURI:{\n
           path: 'cordova/plugin/resolveLocalFileSystemURI'\n        }\n    },\n    clobbers:
{\n        navigator: {\n            children: {\n                connection: {\n        
           path: 'cordova/plugin/network'\n                }\n            }\n        }\n 
  }\n};\n\n});\n\n//@ sourceURL=lib/common/common.js")} catch(e) {console.log("exception:
in lib/common/common.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/exec\", function(require, exports, module) {\n\n/**\n * Execute
a cordova command.  It is up to the native side whether this action\n * is synchronous or
asynchronous.  The native side can return:\n *      Synchronous: PluginResult object as a
JSON string\n *      Asynchrounous: Empty string \"\"\n * If async, the native side will cordova.callbackSuccess
or cordova.callbackError,\n * depending upon the result of the action.\n *\n * @param {Function}
success    The success callback\n * @param {Function} fail       The fail callback\n * @param
{String} service      The name of the service to use\n * @param {String} action       Action
to be run in cordova\n * @param {String[]} [args]     Zero or more arguments to pass to the
method\n */\n\nvar plugins = {\n    \"Device\": require('cordova/plugin/webos/device'),\n
   \"NetworkStatus\": require('cordova/plugin/webos/network'),\n    \"Compass\": require('cordova/plugin/webos/compass'),\n
   \"Camera\": require
 ('cordova/plugin/webos/camera'),\n    \"Accelerometer\" : require('cordova/plugin/webos/accelerometer'),\n
   \"Notification\" : require('cordova/plugin/webos/notification'),\n    \"Geolocation\":
require('cordova/plugin/webos/geolocation')\n};\n\nmodule.exports = function(success, fail,
service, action, args) {\n    try {\n        console.error(\"exec:call plugin:\"+service+\":\"+action);\n
       plugins[service][action](success, fail, args);\n    }\n    catch(e) {\n        console.error(\"missing
exec: \" + service + \".\" + action);\n        console.error(args);\n        console.error(e);\n
       console.error(e.stack);\n    }\n};\n\n});\n\n//@ sourceURL=lib/webos/exec.js")} catch(e)
{console.log("exception: in lib/webos/exec.js: " + e);console.log(e.stack);}
-try {eval("define(\"cordova/platform\", function(require, exports, module) {\n\nmodule.exports
= {\n    id: \"webos\",\n    initialize: function() {\n        if (window.PalmSystem) {\n
           window.PalmSystem.stageReady();\n        }\n        window.Mojo = window.Mojo ||
{};\n        window.Mojo.stageActivated = function() {\n            console.error(\"stageActivated\");\n
       };\n    },\n    clobbers: {\n        requestFileSystem:{\n            path: 'cordova/plugin/webos/requestfilesystem'\n
       },\n        FileReader: {\n            path: \"cordova/plugin/webos/filereader\"\n
       }\n    },\n    merges: {\n        navigator: {\n            children: {\n         
      service: {\n                    path: \"cordova/plugin/webos/service\"\n           
    },\n                application: {\n                    path: \"cordova/plugin/webos/application\"\n
               },\n                window: {\n                    path: \"cordova/plugin/webos/window\"\n
        
        },\n                notification: {\n                    path: \"cordova/plugin/webos/notification\"\n
               },\n                orientation: {\n                    path: \"cordova/plugin/webos/orientation\"\n
               },\n                keyboard: {\n                    path: \"cordova/plugin/webos/keyboard\"\n
               }\n            }\n        }\n    }\n};\n\n});\n\n//@ sourceURL=lib/webos/platform.js")}
catch(e) {console.log("exception: in lib/webos/platform.js: " + e);console.log(e.stack);}
+try {eval("define(\"cordova/platform\", function(require, exports, module) {\n\nvar service=require('cordova/plugin/webos/service'),\n
   cordova = require('cordova');\n\nmodule.exports = {\n    id: \"webos\",\n    initialize:
function() {\n        if (window.PalmSystem) {\n            window.PalmSystem.stageReady();\n
       }\n\n        var Mojo = window.Mojo || {};\n\n        // wait for deviceready before
listening and firing document events\n        document.addEventListener(\"deviceready\", function
() {\n\n            // LunaSysMgr calls this when the windows is maximized or opened.\n  
         window.Mojo.stageActivated = function() {\n                console.log(\"stageActivated\");\n
               cordova.fireDocumentEvent(\"resume\");\n            };\n            // LunaSysMgr
calls this when the windows is minimized or closed.\n            window.Mojo.stageDeactivated
= function() {\n                console.log(\"stageDeactivated\");\n                cordova.fireDocume
 ntEvent(\"pause\");\n            };\n            // LunaSysMgr calls this when a KeepAlive
app's window is hidden\n            window.Mojo.hide = function() {\n                console.log(\"hide\");\n
           };\n            // LunaSysMgr calls this when a KeepAlive app's window is shown\n
           window.Mojo.show = function() {\n                console.log(\"show\");\n     
      };\n\n            // LunaSysMgr calls this whenever an app is \"launched;\" \n     
      window.Mojo.relaunch = function() {\n                // need to return true to tell
sysmgr the relaunch succeeded.\n                // otherwise, it'll try to focus the app,
which will focus the first\n                // opened window of an app with multiple windows.\n
               console.log(\"relaunch\");\n                return true;\n            };\n\n
           // start to listen for network connection changes\n            service.Request('palm://com.palm.connectionmanager',
{\n                method: '
 getstatus',\n                parameters: { subscribe: true },\n                onSuccess:
function (result) {\n                    console.log(\"subscribe:result:\"+JSON.stringify(result));\n\n
                   if (!result.isInternetConnectionAvailable) { \n                       
if (navigator.onLine) {\n                            console.log(\"Firing event:offline\");\n
                           cordova.fireDocumentEvent(\"offline\");\n                     
  }\n                    } else {\n                        console.log(\"Firing event:online\");\n
                       cordova.fireDocumentEvent(\"online\");\n                    }\n   
            },\n                onFailure: function(e) {\n                    console.error(\"subscribe:error\");\n
               }\n            });\n\n        });\n    },\n    clobbers: {\n        requestFileSystem:{\n
           path: 'cordova/plugin/webos/requestfilesystem'\n        },\n        FileReader:
{\n            path: \"cordo
 va/plugin/webos/filereader\"\n        }\n    },\n    merges: {\n        navigator: {\n  
         children: {\n                service: {\n                    path: \"cordova/plugin/webos/service\"\n
               },\n                application: {\n                    path: \"cordova/plugin/webos/application\"\n
               },\n                window: {\n                    path: \"cordova/plugin/webos/window\"\n
               },\n                notification: {\n                    path: \"cordova/plugin/webos/notification\"\n
               },\n                orientation: {\n                    path: \"cordova/plugin/webos/orientation\"\n
               },\n                keyboard: {\n                    path: \"cordova/plugin/webos/keyboard\"\n
               }\n            }\n        }\n    }\n};\n\n});\n\n//@ sourceURL=lib/webos/platform.js")}
catch(e) {console.log("exception: in lib/webos/platform.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/Acceleration\", function(require, exports, module) {\n\nvar
Acceleration = function(x, y, z, timestamp) {\n    this.x = x;\n    this.y = y;\n    this.z
= z;\n    this.timestamp = timestamp || (new Date()).getTime();\n};\n\nmodule.exports = Acceleration;\n\n});\n\n//@
sourceURL=lib/common/plugin/Acceleration.js")} catch(e) {console.log("exception: in lib/common/plugin/Acceleration.js:
" + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/Camera\", function(require, exports, module) {\n\nvar
exec = require('cordova/exec'),\n    Camera = require('cordova/plugin/CameraConstants');\n\nvar
cameraExport = {};\n\n// Tack on the Camera Constants to the base camera plugin.\nfor (var
key in Camera) {\n    cameraExport[key] = Camera[key];\n}\n\n/**\n * Gets a picture from source
defined by \"options.sourceType\", and returns the\n * image as defined by the \"options.destinationType\"
option.\n\n * The defaults are sourceType=CAMERA and destinationType=FILE_URI.\n *\n * @param
{Function} successCallback\n * @param {Function} errorCallback\n * @param {Object} options\n
*/\ncameraExport.getPicture = function(successCallback, errorCallback, options) {\n    options
= options || {};\n    // successCallback required\n    if (typeof successCallback != \"function\")
{\n        console.log(\"Camera Error: successCallback is not a function\");\n        return;\n
   }\n\n    // errorCallback optional\n  
   if (errorCallback && (typeof errorCallback != \"function\")) {\n        console.log(\"Camera
Error: errorCallback is not a function\");\n        return;\n    }\n\n    var quality = 50;\n
   if (typeof options.quality == \"number\") {\n        quality = options.quality;\n    }
else if (typeof options.quality == \"string\") {\n        var qlity = parseInt(options.quality,
10);\n        if (isNaN(qlity) === false) {\n            quality = qlity.valueOf();\n    
   }\n    }\n\n    var destinationType = Camera.DestinationType.FILE_URI;\n    if (typeof
options.destinationType == \"number\") {\n        destinationType = options.destinationType;\n
   }\n\n    var sourceType = Camera.PictureSourceType.CAMERA;\n    if (typeof options.sourceType
== \"number\") {\n        sourceType = options.sourceType;\n    }\n\n    var targetWidth =
-1;\n    if (typeof options.targetWidth == \"number\") {\n        targetWidth = options.targetWidth;\n
   } else if (typeof options.targetWidth == \"string\") 
 {\n        var width = parseInt(options.targetWidth, 10);\n        if (isNaN(width) === false)
{\n            targetWidth = width.valueOf();\n        }\n    }\n\n    var targetHeight =
-1;\n    if (typeof options.targetHeight == \"number\") {\n        targetHeight = options.targetHeight;\n
   } else if (typeof options.targetHeight == \"string\") {\n        var height = parseInt(options.targetHeight,
10);\n        if (isNaN(height) === false) {\n            targetHeight = height.valueOf();\n
       }\n    }\n\n    var encodingType = Camera.EncodingType.JPEG;\n    if (typeof options.encodingType
== \"number\") {\n        encodingType = options.encodingType;\n    }\n\n    var mediaType
= Camera.MediaType.PICTURE;\n    if (typeof options.mediaType == \"number\") {\n        mediaType
= options.mediaType;\n    }\n    var allowEdit = false;\n    if (typeof options.allowEdit
== \"boolean\") {\n        allowEdit = options.allowEdit;\n    } else if (typeof options.allowEdit
== \"number\") {\n
         allowEdit = options.allowEdit <= 0 ? false : true;\n    }\n    var correctOrientation
= false;\n    if (typeof options.correctOrientation == \"boolean\") {\n        correctOrientation
= options.correctOrientation;\n    } else if (typeof options.correctOrientation == \"number\")
{\n        correctOrientation = options.correctOrientation <=0 ? false : true;\n    }\n
   var saveToPhotoAlbum = false;\n    if (typeof options.saveToPhotoAlbum == \"boolean\")
{\n        saveToPhotoAlbum = options.saveToPhotoAlbum;\n    } else if (typeof options.saveToPhotoAlbum
== \"number\") {\n        saveToPhotoAlbum = options.saveToPhotoAlbum <=0 ? false : true;\n
   }\n    var popoverOptions = null;\n    if (typeof options.popoverOptions == \"object\")
{\n        popoverOptions = options.popoverOptions;\n    }\n\n    var args = [quality, destinationType,
sourceType, targetWidth, targetHeight, encodingType,\n                mediaType, allowEdit,
correctOrientation, saveToPhotoAlbum, popoverOpti
 ons];\n\n    exec(successCallback, errorCallback, \"Camera\", \"takePicture\", args);\n};\n\ncameraExport.cleanup
= function(successCallback, errorCallback) {\n    exec(successCallback, errorCallback, \"Camera\",
\"cleanup\", []);\n};\n\nmodule.exports = cameraExport;\n\n});\n\n//@ sourceURL=lib/common/plugin/Camera.js")}
catch(e) {console.log("exception: in lib/common/plugin/Camera.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/CameraConstants\", function(require, exports, module)
{\n\nmodule.exports = {\n  DestinationType:{\n    DATA_URL: 0,         // Return base64 encoded
string\n    FILE_URI: 1          // Return file uri (content://media/external/images/media/2
for Android)\n  },\n  EncodingType:{\n    JPEG: 0,             // Return JPEG encoded image\n
   PNG: 1               // Return PNG encoded image\n  },\n  MediaType:{\n    PICTURE: 0,
         // allow selection of still pictures only. DEFAULT. Will return format specified
via DestinationType\n    VIDEO: 1,            // allow selection of video only, ONLY RETURNS
URL\n    ALLMEDIA : 2         // allow selection from all media types\n  },\n  PictureSourceType:{\n
   PHOTOLIBRARY : 0,    // Choose image from picture library (same as SAVEDPHOTOALBUM for
Android)\n    CAMERA : 1,          // Take picture from camera\n    SAVEDPHOTOALBUM : 2  //
Choose image from picture library (same as PHOTOLIBRARY for Android)\
 n  },\n  PopoverArrowDirection:{\n      ARROW_UP : 1,        // matches iOS UIPopoverArrowDirection
constants to specify arrow location on popover\n      ARROW_DOWN : 2,\n      ARROW_LEFT :
4,\n      ARROW_RIGHT : 8,\n      ARROW_ANY : 15\n  }\n};\n\n});\n\n//@ sourceURL=lib/common/plugin/CameraConstants.js")}
catch(e) {console.log("exception: in lib/common/plugin/CameraConstants.js: " + e);console.log(e.stack);}
@@ -102,7 +102,7 @@ try {eval("define(\"cordova/plugin/webos/file\", function(require, exports,
modu
 try {eval("define(\"cordova/plugin/webos/filereader\", function(require, exports, module)
{\n\nvar FileError = require('cordova/plugin/FileError'),\n    ProgressEvent = require('cordova/plugin/ProgressEvent');\n\nvar
FileReader = function() {\n    this.fileName = \"\";\n\n    this.readyState = 0; // FileReader.EMPTY\n\n
   // File data\n    this.result = null;\n\n    // Error\n    this.error = null;\n\n    //
Event handlers\n    this.onloadstart = null;    // When the read starts.\n    this.onprogress
= null;     // While reading (and decoding) file or fileBlob data, and reporting partial file
data (progess.loaded/progress.total)\n    this.onload = null;         // When the read has
successfully completed.\n    this.onerror = null;        // When the read has failed (see
errors).\n    this.onloadend = null;      // When the request has completed (either in success
or failure).\n    this.onabort = null;        // When the read has been aborted. For instance,
by invoking the abort() m
 ethod.\n};\n\nFileReader.prototype.readAsText = function(file, encoding) {\n    console.error(\"webos
plugin filereader readastext:\" + file);\n    //Mojo has no file i/o yet, so we use an xhr.
very limited\n\n    // Already loading something\n    if (this.readyState == FileReader.LOADING)
{\n        throw new FileError(FileError.INVALID_STATE_ERR);\n    }\n\n    // LOADING state\n
   this.readyState = FileReader.LOADING;\n\n    // If loadstart callback\n    if (typeof this.onloadstart
=== \"function\") {\n        this.onloadstart(new ProgressEvent(\"loadstart\", {target:this}));\n
   }\n\n    // Default encoding is UTF-8\n    var enc = encoding ? encoding : \"UTF-8\";\n\n
   var me = this;\n\n    var xhr = new XMLHttpRequest();\n    xhr.onreadystatechange = function()
{\n        console.error(\"onreadystatechange:\"+xhr.readyState+\" \"+xhr.status);\n     
  if (xhr.readyState == 4) {\n            if (xhr.status == 200 && xhr.responseText)
{\n                console.error(\"file re
 ad completed\");\n                // Save result\n                me.result = xhr.responseText;\n\n
               // If onload callback\n                if (typeof me.onload === \"function\")
{\n                    me.onload(new ProgressEvent(\"load\", {target:me}));\n            
   }\n\n                // DONE state\n                me.readyState = FileReader.DONE;\n\n
               // If onloadend callback\n                if (typeof me.onloadend === \"function\")
{\n                    me.onloadend(new ProgressEvent(\"loadend\", {target:me}));\n      
         }\n\n            } else {\n                // If DONE (cancelled), then don't do
anything\n                if (me.readyState === FileReader.DONE) {\n                    return;\n
               }\n\n                // DONE state\n                me.readyState = FileReader.DONE;\n\n
               me.result = null;\n\n                // Save error\n                me.error
= new FileError(FileError.NOT_FOUND_ERR);\n\n    
             // If onerror callback\n                if (typeof me.onerror === \"function\")
{\n                    me.onerror(new ProgressEvent(\"error\", {target:me}));\n          
     }\n\n                // If onloadend callback\n                if (typeof me.onloadend
=== \"function\") {\n                    me.onloadend(new ProgressEvent(\"loadend\", {target:me}));\n
               }\n            }\n        }\n    };\n    xhr.open(\"GET\", file, true);\n 
  xhr.send();\n};\n\nmodule.exports = FileReader;\n\n});\n\n//@ sourceURL=lib/webos/plugin/webos/filereader.js")}
catch(e) {console.log("exception: in lib/webos/plugin/webos/filereader.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/webos/geolocation\", function(require, exports, module)
{\n\nvar service = require('cordova/plugin/webos/service');\n\nmodule.exports = {\n    getLocation:
function(successCallback, errorCallback, options) {\n        console.error(\"webos plugin
geolocation getlocation\");\n        var request = service.Request('palm://com.palm.location',
{\n            method: \"getCurrentPosition\",\n            onSuccess: function(event) {\n
               var alias={};\n                alias.lastPosition = {\n                   
coords: {\n                        latitude: event.latitude,\n                        longitude:
event.longitude,\n                        altitude: (event.altitude >= 0 ? event.altitude:
null),\n                        speed: (event.velocity >= 0 ? event.velocity: null),\n
                       heading: (event.heading >= 0 ? event.heading: null),\n         
              accuracy: (event.horizAccuracy >= 0 ? event.horizAccuracy: null)
 ,\n                        altitudeAccuracy: (event.vertAccuracy >= 0 ? event.vertAccuracy:
null)\n                    },\n                    timestamp: new Date().getTime()\n     
          };\n\n                successCallback(alias.lastPosition);\n            },\n   
        onFailure: function() {\n                errorCallback();\n            }\n       
});\n    }\n};\n\n});\n\n//@ sourceURL=lib/webos/plugin/webos/geolocation.js")} catch(e) {console.log("exception:
in lib/webos/plugin/webos/geolocation.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/webos/keyboard\", function(require, exports, module) {\n\nvar
_isShowing = null,\n    _manual = null;\n\nmodule.exports = {\n    types: {\n        text:
0,\n        password: 1,\n        search: 2,\n        range: 3,\n        email: 4,\n     
  number: 5,\n        phone: 6,\n        url: 7,\n        color: 8\n    },\n    isShowing:
function() {\n        return !!_isShowing;\n    },\n    show: function(type){\n        if(this.isManualMode())
{\n            PalmSystem.keyboardShow(type || 0);\n        }\n    },\n    hide: function(){\n
       if(this.isManualMode()) {\n            PalmSystem.keyboardHide();\n        }\n    },\n
   setManualMode: function(mode){\n        _manual = mode;\n        PalmSystem.setManualKeyboardEnabled(mode);\n
   },\n    isManualMode: function(){\n        return _manual || false;\n    },\n    forceShow:
function(inType){\n        this.setManualMode(true);\n        PalmSystem.keyboardShow(inType
|| 0);\n    },\n    forceHi
 de: function(){\n        this.setManualMode(true);\n        PalmSystem.keyboardHide();\n
   }\n};\n\n});\n\n//@ sourceURL=lib/webos/plugin/webos/keyboard.js")} catch(e) {console.log("exception:
in lib/webos/plugin/webos/keyboard.js: " + e);console.log(e.stack);}
-try {eval("define(\"cordova/plugin/webos/network\", function(require, exports, module) {\n\nvar
service=require('cordova/plugin/webos/service');\n\nmodule.exports = {\n    /**\n     * Get
connection info\n     *\n     * @param {Function} successCallback The function to call when
the Connection data is available\n     * @param {Function} errorCallback The function to call
when there is an error getting the Connection data. (OPTIONAL)\n     */\n    getConnectionInfo:
function (successCallback, errorCallback) {\n        // Get info\n        console.log(\"webos
Plugin: NetworkStatus - getConnectionInfo\");\n\n        service.Request('palm://com.palm.connectionmanager',
{\n            method: 'getstatus',\n            parameters: {},\n            onSuccess: function
(result) {\n                console.log(\"result:\"+JSON.stringify(result));\n\n         
      var info={};\n                if (!result.isInternetConnectionAvailable) { info.type=\"Connection.NONE\";
}\n                if (
 result.wifi.onInternet) { info.type=\"Connection.WIFI\"; }\n                if (result.wan.state===\"connected\")
{ info.type=\"Connection.CELL_2G\"; }\n\n                successCallback(info.type);\n   
        },\n            onFailure: errorCallback\n        });\n    }\n};\n\n});\n\n//@ sourceURL=lib/webos/plugin/webos/network.js")}
catch(e) {console.log("exception: in lib/webos/plugin/webos/network.js: " + e);console.log(e.stack);}
+try {eval("define(\"cordova/plugin/webos/network\", function(require, exports, module) {\n\nvar
service=require('cordova/plugin/webos/service'),\n    Connection = require('cordova/plugin/Connection');\n\nmodule.exports
= {\n    /**\n     * Get connection info\n     *\n     * @param {Function} successCallback
The function to call when the Connection data is available\n     * @param {Function} errorCallback
The function to call when there is an error getting the Connection data. (OPTIONAL)\n    
*/\n    getConnectionInfo: function (successCallback, errorCallback) {\n        // Get info\n
       console.log(\"webos Plugin: NetworkStatus - getConnectionInfo\");\n\n        service.Request('palm://com.palm.connectionmanager',
{\n            method: 'getstatus',\n            parameters: {},\n            onSuccess: function
(result) {\n                console.log(\"result:\"+JSON.stringify(result));\n\n         
      var info={};\n                if (!result.isInternetConnectionAvailable) 
 { info.type=Connection.NONE; }\n                if (result.wifi.onInternet) { info.type=Connection.WIFI;
}\n                if (result.wan.state===\"connected\") { info.type=Connection.CELL_2G; }\n\n
               successCallback(info.type);\n            },\n            onFailure: errorCallback\n
       });\n    }\n};\n\n});\n\n//@ sourceURL=lib/webos/plugin/webos/network.js")} catch(e)
{console.log("exception: in lib/webos/plugin/webos/network.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/webos/notification\", function(require, exports, module)
{\n\nmodule.exports = {\n    /*\n     * adds a dashboard to the WebOS app\n     * @param {String}
url\n     * @param {String} html\n     * Example:\n     *        navigator.notification.newDashboard(\"dashboard.html\");\n
    */\n    newDashboard: function(url, html) {\n        var win = window.open(url, \"_blank\",
\"attributes={\\\"window\\\":\\\"dashboard\\\"}\");\n        html && win.document.write(html);\n
       win.PalmSystem.stageReady();\n    },\n\n    /*\n     * Displays a banner notification.
If specified, will send your 'response' object as data via the 'palmsystem' DOM event.\n 
   * If no 'icon' filename is specified, will use a small version of your application icon.\n
    * @param {String} message\n     * @param {Object} response\n     * @param {String} icon\n
    * @param {String} soundClass class of the sound; supported classes are: \"ringtones\",
\"alerts\", \"alarm\", \"ca
 lendar\", \"notification\"\n     * @param {String} soundFile partial or full path to the
sound file\n     * @param {String} soundDurationMs of sound in ms\n     * Example:\n     *
       navigator.notification.showBanner('test message');\n     */\n    showBanner: function(message,
response, icon, soundClass, soundFile, soundDurationMs) {\n        response = response ||
{\n            banner: true\n        };\n        PalmSystem.addBannerMessage(message, JSON.stringify(response),
icon, soundClass, soundFile, soundDurationMs);\n    },\n\n    /**\n     * Remove a banner
from the banner area. The category parameter defaults to 'banner'. Will not remove\n     *
messages that are already displayed.\n     * @param {String} category\n            Value defined
by the application and usually same one used in {@link showBanner}.\n            It is used
if you have more than one kind of banner message.\n     */\n    removeBannerMessage: function(category)
{\n        var bannerKey = category || 
 'banner';\n        var bannerId = this.banners.get(bannerKey);\n        if (bannerId) {\n
           try {\n                PalmSystem.removeBannerMessage(bannerId);\n            }
catch(removeBannerException) {\n                window.debug.error(removeBannerException.toString());\n
           }\n        }\n    },\n\n    /*\n     * Remove all pending banner messages from
the banner area. Will not remove messages that are already displayed.\n     */\n    clearBannerMessage:
function() {\n        PalmSystem.clearBannerMessage();\n    },\n\n    /*\n     * This function
vibrates the device\n     * @param {number} duration The duration in ms to vibrate for.\n
    * @param {number} intensity The intensity of the vibration\n     */\n    vibrate_private:
function(duration, intensity) {\n        //the intensity for palm is inverted; 0=high intensity,
100=low intensity\n        //this is opposite from our api, so we invert\n        if (isNaN(intensity)
|| intensity > 100 || intensity <= 0)\n
         intensity = 0;\n        else\n        intensity = 100 - intensity;\n\n        //
if the app id does not have the namespace \"com.palm.\", an error will be thrown here\n  
     //this.vibhandle = new Mojo.Service.Request(\"palm://com.palm.vibrate\", {\n        this.vibhandle
= navigator.service.Request(\"palm://com.palm.vibrate\", {\n            method: 'vibrate',\n
           parameters: {\n                'period': intensity,\n                'duration':
duration\n            }\n        },\n        false);\n    },\n\n    vibrate: function(param)
{\n        PalmSystem.playSoundNotification('vibrate');\n    },\n    /*\n     * Plays the
specified sound\n     * @param {String} soundClass class of the sound; supported classes are:
\"ringtones\", \"alerts\", \"alarm\", \"calendar\", \"notification\"\n     * @param {String}
soundFile partial or full path to the sound file\n     * @param {String} soundDurationMs of
sound in ms\n     */\n    beep: function(param) {\n        PalmSyst
 em.playSoundNotification('alerts');\n    },\n\n    getRootWindow: function() {\n        var
w = window.opener || window.rootWindow || window.top || window;\n        if(!w.setTimeout)
{ // use this window as the root if we don't have access to the real root.\n            w
= window;\n        }\n        return w;\n    },\n\n    open: function(inOpener, inUrl, inName,
inAttributes, inWindowInfo) {\n        var url = inUrl;\n        var a = inAttributes &&
JSON.stringify(inAttributes);\n        a = \"attributes=\" + a;\n        var i = inWindowInfo
? inWindowInfo + \", \" : \"\";\n        return inOpener.open(url, inName, i + a);\n    },\n\n
   openWindow: function(inUrl, inName, inParams, inAttributes, inWindowInfo) {\n        //var
attributes = inAttributes || {};\n        //attributes.window = attributes.window || \"card\";\n
       // NOTE: make the root window open all windows.\n        return this.open(this.getRootWindow(),
inUrl, inName || \"\", inAttributes, inWindowInfo);\n    
 },\n\n    alert: function(message,callback,title,buttonName) {\n        var inAttributes
= {};\n        //inAttributes.window = \"card\"; // create card\n        inAttributes.window
= \"popupalert\"; // create popup\n        //inAttributes.window=\"dashboard\"; // create
dashboard\n        var html='<html><head><script>setTimeout(function(f){var
el=window.document.getElementById(\"b1\");console.error(el);el.addEventListener(\"click\",function(f){window.close();},false);},500);</script></head><body>'+message+'<br/><button
id=\"b1\">'+buttonName+'</button></body></html>';\n        var inName=\"PopupAlert\";\n
       var inUrl=\"\";\n        var inParams={};\n        var inHeight=120;\n        var w
= this.openWindow(inUrl, inName, inParams, inAttributes, \"height=\" + (inHeight || 200));\n
       w.document.write(html);\n        w.PalmSystem.stageReady();\n    }\n};\n\n});\n\n//@
sourceURL=lib/webos/plugin/webos/notification.js")} catch(e) {console.log("exception: in lib/webos/plugin/
 webos/notification.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/webos/orientation\", function(require, exports, module)
{\n\nmodule.exports = {\n    setOrientation: function(orientation) {\n        PalmSystem.setWindowOrientation(orientation);\n
   },\n\n    /*\n     * Returns the current window orientation\n     * orientation is one
of 'up', 'down', 'left', 'right', or 'free'\n     */\n    getCurrentOrientation: function()
{\n          return PalmSystem.windowOrientation;\n    }\n};\n\n});\n\n//@ sourceURL=lib/webos/plugin/webos/orientation.js")}
catch(e) {console.log("exception: in lib/webos/plugin/webos/orientation.js: " + e);console.log(e.stack);}
 try {eval("define(\"cordova/plugin/webos/requestfilesystem\", function(require, exports,
module) {\n\nmodule.exports = function(type,size,successCallback,errorCallback) {\n    console.error(\"requestFileSystem\");\n\n
   var theFileSystem={};\n    theFileSystem.name=\"webOS\";\n    theFileSystem.root={};\n
   theFileSystem.root.name=\"Root\";\n\n    theFileSystem.root.getFile=function(filename,options,successCallback,errorCallback)
{\n        console.error(\"getFile\");\n        if (options.create) { errorCallback(); }\n
       var theFile=filename;\n        successCallback(theFile);\n    };\n\n    successCallback(theFileSystem);\n};\n\n});\n\n//@
sourceURL=lib/webos/plugin/webos/requestfilesystem.js")} catch(e) {console.log("exception:
in lib/webos/plugin/webos/requestfilesystem.js: " + e);console.log(e.stack);}

http://git-wip-us.apache.org/repos/asf/cordova-webos/blob/50928b79/lib/cordova.webos.js
----------------------------------------------------------------------
diff --git a/lib/cordova.webos.js b/lib/cordova.webos.js
index c9ddb42..faefa15 100644
--- a/lib/cordova.webos.js
+++ b/lib/cordova.webos.js
@@ -1,6 +1,6 @@
-// commit c46b14085ce80cda5f72d6af22bc22afe4c2151d
+// commit 0a4e6fd7f89ad229ed98a4222e83634d5cf7968d
 
-// File generated at :: Tue Nov 27 2012 15:33:15 GMT-0800 (PST)
+// File generated at :: Wed Nov 28 2012 16:21:57 GMT-0800 (PST)
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one
@@ -1035,16 +1035,72 @@ module.exports = function(success, fail, service, action, args) {
 // file: lib/webos/platform.js
 define("cordova/platform", function(require, exports, module) {
 
+var service=require('cordova/plugin/webos/service'),
+    cordova = require('cordova');
+
 module.exports = {
     id: "webos",
     initialize: function() {
         if (window.PalmSystem) {
             window.PalmSystem.stageReady();
         }
-        window.Mojo = window.Mojo || {};
-        window.Mojo.stageActivated = function() {
-            console.error("stageActivated");
-        };
+
+        var Mojo = window.Mojo || {};
+
+        // wait for deviceready before listening and firing document events
+        document.addEventListener("deviceready", function () {
+
+            // LunaSysMgr calls this when the windows is maximized or opened.
+            window.Mojo.stageActivated = function() {
+                console.log("stageActivated");
+                cordova.fireDocumentEvent("resume");
+            };
+            // LunaSysMgr calls this when the windows is minimized or closed.
+            window.Mojo.stageDeactivated = function() {
+                console.log("stageDeactivated");
+                cordova.fireDocumentEvent("pause");
+            };
+            // LunaSysMgr calls this when a KeepAlive app's window is hidden
+            window.Mojo.hide = function() {
+                console.log("hide");
+            };
+            // LunaSysMgr calls this when a KeepAlive app's window is shown
+            window.Mojo.show = function() {
+                console.log("show");
+            };
+
+            // LunaSysMgr calls this whenever an app is "launched;" 
+            window.Mojo.relaunch = function() {
+                // need to return true to tell sysmgr the relaunch succeeded.
+                // otherwise, it'll try to focus the app, which will focus the first
+                // opened window of an app with multiple windows.
+                console.log("relaunch");
+                return true;
+            };
+
+            // start to listen for network connection changes
+            service.Request('palm://com.palm.connectionmanager', {
+                method: 'getstatus',
+                parameters: { subscribe: true },
+                onSuccess: function (result) {
+                    console.log("subscribe:result:"+JSON.stringify(result));
+
+                    if (!result.isInternetConnectionAvailable) { 
+                        if (navigator.onLine) {
+                            console.log("Firing event:offline");
+                            cordova.fireDocumentEvent("offline");
+                        }
+                    } else {
+                        console.log("Firing event:online");
+                        cordova.fireDocumentEvent("online");
+                    }
+                },
+                onFailure: function(e) {
+                    console.error("subscribe:error");
+                }
+            });
+
+        });
     },
     clobbers: {
         requestFileSystem:{
@@ -5685,7 +5741,8 @@ module.exports = {
 // file: lib/webos/plugin/webos/network.js
 define("cordova/plugin/webos/network", function(require, exports, module) {
 
-var service=require('cordova/plugin/webos/service');
+var service=require('cordova/plugin/webos/service'),
+    Connection = require('cordova/plugin/Connection');
 
 module.exports = {
     /**
@@ -5705,9 +5762,9 @@ module.exports = {
                 console.log("result:"+JSON.stringify(result));
 
                 var info={};
-                if (!result.isInternetConnectionAvailable) { info.type="Connection.NONE";
}
-                if (result.wifi.onInternet) { info.type="Connection.WIFI"; }
-                if (result.wan.state==="connected") { info.type="Connection.CELL_2G"; }
+                if (!result.isInternetConnectionAvailable) { info.type=Connection.NONE; }
+                if (result.wifi.onInternet) { info.type=Connection.WIFI; }
+                if (result.wan.state==="connected") { info.type=Connection.CELL_2G; }
 
                 successCallback(info.type);
             },


Mime
View raw message