JavaScript Hardening Tutorial--native.js Sample Rollup

Source: Internet
Author: User

This article ish5eduAgency officialHTML5 Trainingtutorials, the main introduction:JavaScript Intensive Tutorials--native.js Sample Rollup
 

native.js is powerful and open, but many web developers are not familiar with native APIs and are difficult to accomplish independently. The purpose of this post is to summarize the various written NJS code to facilitate web developers. Crowds, the ability of developers to submit a lot of NJS code, everyone will give you praise, 
Android platform in desktop Create and delete app shortcut see hello h5+ native.js part demo and source code. Or search for "shortcuts" here, http://ask.dcloud.net.cn/docs/ ... le/88 call Android Local share http://ask.dcloud.net.cn/article/ 134 Call directly http://ask.dcloud.net.cn/question/4035 switch the program to the background http://ask.dcloud.net.cn/question/2484 force eject the soft keyboard/HTTP/ ask.dcloud.net.cn/question/2324 get Android device device.uuidhttp://ask.dcloud.net.cn/question/3510 get memory and CPU information/HTTP ask.dcloud.net.cn/question/2202 Turn off Bluetooth http://ask.dcloud.net.cn/question/4720 monitor bluetooth switch status http://ask.dcloud.net.cn/ article/274 Get Bluetooth Device list Http://ask.dcloud.net.cn/question/8265NFC data read http://ask.dcloud.net.cn/question/6726 screenshot http:/ /ask.dcloud.net.cn/question/5344 get MAC address http://ask.dcloud.net.cn/question/1511 open Network settings http://ask.dcloud.net.cn/ question/1475 Open location information http://ask.dcloud.net.cn/question/14731 get WiFi list http://ask.dcloud.net.cn/question/ 12113 call system control to play video http://ask.dcloud.net.cn/question/614 call OS Address Book selection control http://ask.dcloud.net.cn/question/ 5783 Native Calendar Reminder Insert http://ask.dcloud.net.cn/article/215 Call system control crop picture http://ask.dcloud.net.cn/question/8314 copy content toSystem Pasteboard http://ask.dcloud.net.cn/question/2034 Call Text to Speech function (TTS) http://ask.dcloud.net.cn/question/ 6473 after calling other activity to get the return result http://ask.dcloud.net.cn/question/5783 receiving system broadcast message via Startactivityforresult, If you are listening to an event http://ask.dcloud.net.cn/article/222 the APK, determine if the app is installed http://ask.dcloud.net.cn/question/ 7604 to monitor the mobile phone flight mode switch as an example of how to use Native.js for Broadcastreceiver broadcast http://ask.dcloud.net.cn/question/7661 resident Android notification bar, Without a push implement local message push (local notification) http://ask.dcloud.net.cn/question/2464 call Native socket connection/HTTP/ ASK.DCLOUD.NET.CN/QUESTION/60 start a native servicehttp://ask.dcloud.net.cn/question/433 stop, turn on push push function Var pushmanager  = plus.android.importclass ("Com.igexin.sdk.PushManager");var context =  Plus.android.runtimeMainActivity (); Function enable ()  {     Pushmanager.getinstance (). Turnonpush (context);} Function disable ()  {    pushmanager.getinstance (). TurnOffPush (context);} Thanks to Yeahcheung sharing the use of native.js to get the phone GPS open http://ask.dcloud.net.cn/question/11890 viaNative.js Set System wallpaper Http://ask.dcloud.net.cn/article/651iOS platform Get package name Var nsbundle = plus.ios.importclass (' NSBundle '); Var bundle = nsbundle.mainbundle (); Console.log (Bundle.bundleidentifier ()); Plus.ios.deleteObject (bundle); Gets the device name http://ask.dcloud.net.cn/question/14691 tests whether an app is installed http://ask.dcloud.net.cn/ question/14430 call iOS print apihttp://ask.dcloud.net.cn/question/4226 via native.js login game center See hello h5+ Native.js part of the demonstration and source code. Or search here for "Game center", http://ask.dcloud.net.cn/docs/ ... le/88 set get content to System Pasteboard/HTTP// ask.dcloud.net.cn/question/3720 Open page Default pop-up keyboard http://ask.dcloud.net.cn/question/2324 play beep http://ask.dcloud.net.cn/ question/3962 call iOS text-to-speech (TTS) http://ask.dcloud.net.cn/question/4175 save Base64 data as a picture http://ask.dcloud.net.cn/ question/6190 set WebView sliding speed reduction var webview = plus.ios.currentwebview (); var scrollview =  webview.plusgetattribute ("ScrollView"); Scrollview.plussetattribute ("Decelerationrate:", 0.99); Open the WiFi Settings page for iOS http://ask.dcloud.net.cn/question/7797 determine whether to turn on message notification http://ask.dcloud.net.cn/question/4497 detect if iOS allows the camera (thanks to the little fuss sharing) http://ask.dcloud.net.cn/ Article/188ios gets the time zone Idvar nstimezone = plus.ios.importclass ("Nstimezone") of the system; var sys =  nstimezone.systemtimezone (); Console.log (Sys.plusgetattribute ("name")); Status bar display network request Snowflake Var uiapplication  = plus.ios.import ("UIApplication");var sharedapplication =  Uiapplication.sharedapplication (); sharedapplication.setnetworkactivityindicatorvisible (true); Plus.ios.deleteObject (sharedapplication); Gets the GPS authorization status Var cllocationmanager = plus.ios.import (" Cllocationmanager "); Var authorizationstatus = cllocationmanager.authorizationstatus (); switch ( Authorizationstatus)  {      case 0:       /// user has not yet made a choice with regards to  this application      break;&nbsP;     case 1:      // this application  is not authorized to use location services.  Due     // to active restrictions on location services, the user  cannot change    // this status, and may not have  personally denied authorization      break;       case 2:        // User has  explicitly denied authorization for this application, or      location services are disabled in Settings.       break;      case 3:        //  user has granted authorization to use their location at any time,     // including monitoring for regions, visits, or significant  location changes.      break;      case  4:       // user has granted authorization to  use their location only when your app    // is  visible to them  (it will be made visible to them if  you continue to    // receive location updates while  in the background) .  authorization to use    //  launch apis has not been granted.      break;       caSe 5:     // this value is deprecated, but was  equivalent to the new -Always value.      break;       defalut:      break;} Get phone storage space Var bundleclass = plus.ios.importclass ("NSBundle");var bundleobj =  Bundleclass.mainbundle (); Var filenamagerobj = plus.ios.newobject ("NSFileManager");var  Fileattr = plus.ios.invoke (Filenamagerobj, "Attributesoffilesystemforpath:error:", Bundleobj.bundlepath (), NULL);// nsfilesystemfreesize  parameter to get the remaining space// nsfilesystemsize   Get phone total storage space Var freespace = plus.ios.invoke (FileAttr, "Objectforkey:", "nsfilesystemfreesize"); var  numberformatterobj = plus.ios.newobject ("Nsnumberformatter"); var freespacestr =  plus.ios.invoke (Numberformatterobj, "Stringfromnumber:", freeSpace); var freespace = freespacestr / 1024/1024/1024; read these examples, do not think JS is particularly powerful? Hurry up and use it!

Click to enter JS Intensive tutorial

This article is from the "11721999" blog, please be sure to keep this source http://11731999.blog.51cto.com/11721999/1837169

JavaScript Hardening Tutorial--native.js Sample Rollup

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.