http://bbs.51pda.cn/simple/?t5629.html
WebOS程序原理
Application Framework
From WebOS Internals
Jump to: navigation, search
todo: talk about the app framework!
Applications that come bundled on the device are located here.
root@castle:/usr/palm/applications# ls -lah
drwxr-xr-x 44 root root 4.0k May 22 13:10 .
drwxr-xr-x 8 root root 4.0k May 22 14:37 ..
drwxr-xr-x 6 root root 4.0k Dec 31 1999 com.handson.app.nascar
drwxr-xr-x 6 root root 4.0k Dec 31 1999 com.mobitv.app.sprinttv
--More--
root@castle:/usr/palm/applications#
Where as downloaded applications from the Palm app store are here.
root@castle:/var/usr/palm/applications# ls -lah
drwxr-xr-x 11 root root 4.0k Jun 10 20:05 .
drwxr-xr-x 3 root root 4.0k May 29 14:48 ..
drwxr-xr-x 7 root root 4.0k Jun 6 19:53 com.accuweather.palm
drwxr-xr-x 6 root root 4.0k Jun 6 13:12 com.flixster.app.movies
drwxr-xr-x 8 root root 4.0k Jun 8 14:34 com.lumoslabs.speed-brain
drwxr-xr-x 6 root root 4.0k Jun 10 20:05 com.motionapps.app.classic
drwxr-xr-x 5 root root 4.0k Jun 6 11:49 com.palm.pandora
--More--
root@castle:/var/usr/palm/applications#
The applications use a standard MVC (Model, View, Controller) format.
//TODO : Use an existing application to explain framework
Native Applications
It is obvious to see that the Classic app is not purely JavaScript, and native code would have to be required. How did they pull it off? Quite simply; they used a browser plugin.
//Setup the adapter
sampleAdapterApp = document.createElement('object');
sampleAdapterApp.type = 'application/x-motionapps-partsadapter';
sampleAdapterApp.width = 320;
sampleAdapterApp.height = 320;
|
znsoft | |
它實際上使用的是標準的NPAPI方式對webkit進行的擴展,所以可能真沒有所謂的native API了 |
注:我還沒看這個原理是啥,現在還看不懂,先記錄,後面再仔細分析。