What is the state of whitelisting in phonegap 1.3.0?

The whitelist is present on both iOS and Android, but not other platforms yet. Under iOS, it goes under the name of “External Hosts,” which is explained here: http://wiki.phonegap.com/w/page/41631150/PhoneGap%20for%20iOS%20FAQ Q. Links to and imported files from external hosts don’t load? A. The latest code has the new white-list feature. If you are referencing external hosts, … Read more

Objective-C Wrapper for CFunctionPointer to a Swift Closure

I needed to define this callback: typedef void (*MIDIReadProc) ( const MIDIPacketList *pktlist, void *readProcRefCon, void *srcConnRefCon ); and I wanted to use Objective-C as least as possible. This was my approach: MIDIReadProcCallback.h #import <Foundation/Foundation.h> #import <AudioToolbox/AudioToolbox.h> typedef void (^OnCallback)(const MIDIPacketList *packetList); @interface MIDIReadProcCallback : NSObject + (void (*)(const MIDIPacketList *pktlist, void *readProcRefCon, void *srcConnRefCon))midiReadProc; … Read more

How to create a proper Volley Listener for cross class Volley method calling

For your requirement, I suggest you refer to my following solution, hope it’s clear and helpful: First is the interface: public interface VolleyResponseListener { void onError(String message); void onResponse(Object response); } Then inside your helper class (I name it VolleyUtils class): public static void makeJsonObjectRequest(Context context, String url, final VolleyResponseListener listener) { JsonObjectRequest jsonObjectRequest = … Read more

Load javascript async, then check DOM loaded before executing callback

What you need is a simple queue of onload functions. Also please avoid browser sniffing as it is unstable and not future proof. For full source code see the [Demo] var onload_queue = []; var dom_loaded = false; function loadScriptAsync(src, callback) { var script = document.createElement(‘script’); script.type = “text/javascript”; script.async = true; script.src = src; … Read more