javascript - Phonegap + require Js -


how can use phonegap require js ? try add phonegap using require() method. code given below , .js files in correct location. please me, able load phonegap via amd , or use normal script method

<script type="text/javascript" src="cordova.js"></script> 

this require config , methods

require.config({             baseurl: 'js/lib',             paths: {            controller: '../controller/controller',            model: '../model/model',            view: '../view/view',            router:'../router/router'            },            /* map: {            '*': {            'tempname': 'actualname'            }            },*/             shim: {            'backbone': {            deps: ['underscore', 'jquery','cordova'],            exports: 'backbone'            },            'underscore': {            exports: '_'            }            }            });    require(['jquery', 'backbone', 'router', ], function ($, backbone, router) {      document.addeventlistener('deviceready', function () {         alert('hi'); // working         navigator.notification.alert('hi'); // not working      }, false);  }); 

requirejs , phonegap tends not work together.

the best way have found include cordova script before require modules.

<script type="text/javascript" src="cordova-2.7.0.js"></script> <script data-main="js/main" src="require.js"></script>  

check the answer this question. gives insight of problems faced.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -