incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse MacFadyen <purplecabb...@gmail.com>
Subject Re: JS-Plugin code for cordova 1.6+
Date Tue, 17 Apr 2012 09:47:51 GMT
The native callback piece will vary by platform, but you should not be
calling named JavaScript. Have a look at one of the simpler apis, like
Accelerometer.

Callbacks should be routed via cordova result/error handler.
iOS example here:
https://github.com/purplecabbage/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVAccelerometer.m#L124

The result will be passed to the callback function you passed to exec.

Cheers,
  Jesse

Sent from my iPhone5

On 2012-04-17, at 1:58 AM, Viras <viras@users.sourceforge.net> wrote:

> Nevermind I figured it out myself. Stupid me forgot that plugins reside outside the actual
cordova namespace prefix and therefor I need to prefix "cordova" to function calls like require,
define, etc. :).
>
> BTW: Should the actual application code use "cordova.require('whatever').function()"
or is there any "shortcut" to plugins? (since window.plugins is deprecated, right?)
>
> Best,
> Viras
>
> Am 2012-04-17 10:02, schrieb Viras:
>> Hi,
>>
>> is there some kind of guide on how to design a non-core plugin for
>> cordova 1.6+?
>>
>> I'm a bit confused on how to define a custom plugin code to be fully
>> compliant to the new scheme. I tried to look up how the core plugins
>> work but they seem to be statically defined in common/common.js which
>> is not possible for a non-core plugin (obviously).
>>
>> I would appreciate any hints!
>>
>> Best,
>> Viras
>
> --
> GOFG - Get On Fat Guy
> http://www.gofg.at/ - powered by Cordova

Mime
View raw message