Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by yatayata

some questions on iOS impact:

1) http requests?
Does the iOS build of impact support ajax calls? I wanted to see what problems might lie ahead.

since iOS impact is using JavaScriptCore (apples JS interpreter), is it safe to assume that all pure js language features are supported? eg:
xmlHttp = new XMLHttpRequest();

of course all the DOM stuff is not there but not exactly sure where the border between browser interpreter.

I was also going to try including zepto.js to get a better interface to ajax calls - but not deal with all of JQuery. zepto is more modular so i can remove the DOM dependent code too.

2) browser dialogs
the next step, in terms of getting dialogs inside iOS impact would seem to be a big step. has anyone started on this? i am specifically interested in getting a native performance impact game out, that supports the facebook APIs, which seem to rely a lot on browser/ uiWebView dialogs...

3) phonegap?
has anyone looked at getting iOS impact running within phonegap? this would allow a lot of other normal browser features as part of a larger app. eg a shop system, or to take advantage of other phonegap plugins for stuff like twitter or IAP.

if anyone is interested in working on these features as a dev contract, i have budget for this.

1 decade ago by dominic

XMLHttpRequest is not available in the native iOSImpact. It's using JavaScriptCore, yes, but the only libraries that are part of it are those for the built-in objects: Date, Function, Array etc. See here for a complete list.

Everything that needs to go "outside" of JSC to work is not part of it. E.g.
functions like setInterval() are not part of JSC either, but I rewrote it for iOSImpact.

Impact works nicely with PhoneGap, but obviously you have the same restrictions as in Mobile Safari, because it uses Mobile Safari under the hood.

You may want to have a look at appMobi - they have the native rendering technology, "DirectCanvas", and a normal UIWebView with all DOM and AJAX features combined.

1 decade ago by yatayata

interesting... so to take it a bit further, I see you have this implementation for setInterval()

JS_FUNC( JS_iOSImpact, setInterval, ctx, argc, argv ) {
	return [self createTimer:ctx argc:argc argv:argv repeat:YES];
}

so providing a bridge to native functionality to be called from JS is done by defining a method signature like the above, and then using the equivalent C methods.

If i wanted to define the XMLHttpRequest, then i would also need to be able to asynchronously callback to the JS code, which I guess this is an example of:

JSObjectRef func = [[timer userInfo] pointerValue];
[[Impact instance] invokeCallback:func thisObject:NULL argc:0 argv:NULL];

and then implement networking calls in ObjC. these would also be async so it maybe a bit messy but seems doable.


are there any other big areas missing from iOS impact (apart from DOM)?

1 decade ago by EugeneLab

Having the same problem with ajax calls in iosimpact app.

I'm trying to implement scoreoid for online leaderboards but looks like no chance at the moment.

So I wonder if anyone made it work?

1 decade ago by EugeneLab

Ok.
So here is the thing to think about.

I've made ajax calls work with PhoneGap. And thats great for online leaderboard.

But.

There is no sound with PhoneGap at all. No sound for Safari Mobile (

So at the moment I have to choose between no sound and no online leaderboards for the game. And it is really disappointing.

Dominic, could you please include XMLHttpRequest into iOSImpact?
That would be great for all the community!

Thanks!

1 decade ago by danbaker

I need the same functionality. I am trying to save/retrieve level data. I understand that Apple will not allow scripts to be ajax'ed in, but I've seen levels and highscores work on several games. I would recommend adding this functionality too.

What I really want is something like:
$.getJSON("test.js", function(json) {
alert("JSON Data: " + json.users[3].name);
});
$.putJSON("test.js", json);
$.postJSON("test.js", json);

1 decade ago by mimik

Ajax = winning.
Would be so powerful to have that available.
Page 1 of 1
« first « previous next › last »