Blackberry is not defined, using Webworks - blackberry-10

In my WebWorks application I have the following in my config.xml;
<feature id="blackberry.invoke.card" />
and in my main page I imported the following JS:
`
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js" type="text/javascript"></script>
<script src="js/BlackBerry-JQM-Init.js" type="text/javascript"></script>
<script src="js/BlackBerry-JQM.js" type="text/javascript"></script>
<script src="local:///chrome/webworks.js" type="text/javascript"></script>
<script src="js/index.js" type="text/javascript"></script>
`
But whenever the code attempts to run blackberry.invoke.card.invokeEmailComposer(...) I get "blackberry is not defined". What am I missing to properuly use the Blackberry libraries, specifically to send an email message? All the examples from Github and other sites also failed to work.

Edit: Re-wrote since you're using WebWorks 2.0 Beta
I see the problem. You're doing things the "old way".
Since WebWorks 2.0 is running on Cordova, a few things have changed. Really quickly, I can see that you're including the 'local:///webworks.js'. That is incorrect for v2.0.
You need to include cordova.js now. Take a look at the sample project that comes with WebWorks 2.0 when you create a new project.
Here's the full Getting Started Guide that should get you up to speed. If you would rather use the command line, take a look at the build instructions at the end of any of the sample apps. Again, feel free to reference or use and adapt any of the sample apps as well # https://github.com/blackberry/BB10-WebWorks-Samples/tree/WebWorks-2.0

Related

how to setup Karma with Ui5

I have a question related to karma and ui5.
Current situation is as follows:
I use karma-openui5 and load ui5 via bower. Karma-openui5 simply adds some bootstrap information and the core-file itself:
files.unshift({pattern: ui5path, included: true, watched: false, served: true});
which leads to this head entry:
<script type="text/javascript" src="/base/bower_components/openui5-sap.ui.core/resources/sap-ui-core.js" crossorigin="anonymous"></script>
Ui5 is designed to load everything else related to the core-file but is served by sap in different bower packages this means, request is:
http://localhost:9876/base/bower_components/openui5-sap.ui.core/resources/sap/m/library-preload.js
but it's actually located under
http://localhost:9876/base/bower_components/openui5-sap.m/resources/sap/m/library-preload.js
I could overcome this problem with proxy entries. But i can`t include the .css files which one are in a separate bower package. I can't see a way to proxy only */**/.css requests to another directory. Therefore this way just doesn't work well.
Openui5 has already some middleware (connect-openui5) to resolve this problems and server everything as expected under localhost:XXXX/resources/.
How and can i add custom script tags in karma? like:
<script type="text/javascript" src="resources/sap-ui-core.js"></script>
How can i add a middleware (connect-openui5) to handle all requests to /resources/**/*?
The solution was to use the connect middleware from sap, started with grunt and proxy to this.
I packed everything in a yeoman generator, if anyone is interested in the setup.
https://www.npmjs.com/package/generator-ui5

WebStorm 12 EAP - JavaScript debug configuration doesn't work with built-in webserver

I am trying to start debugging session using built-in WebStorm server after I created a new JavaScript debug configuration. I am using this project:
https://github.com/pauldessert/SeedTip.git
I am experiencing this weird problem that all of my locally referenced .css and .js files:
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/style.css">
<script src="js/map.js"></script>
<script src="js/search.js"></script>
...could not be found/loaded by the browser. I show this in bellow image when I pressed F12 to see Chrome Dev tools (this action seems to disconnect WebStorm IDE support extension) and you can see failed requests.
You can see in the console tool window in WebStorm that there were get request for .css and .js local files. When I press any of these links it opens ok in my Chrome browser.
E.g. this file does exist:
http://localhost:63342/SeedTip/css/style.css
When I use an external node server e.g. grunt-serve and create JS debug configuration with URL: http://localhost:9000/index.html pointing to:
F:\Projects\Angular\v2\SeedTip and run this debug it works.
Note: I have the same problem with enabling Angular 2 apps to load with systemjs.
I tried setting but it doesn't help.
I was a known bug, that was fixed in the latest build.

Phonegap 3.0 InAppBrowser - Provides no way for user to close

I had inApBrowser working in my app just fine... however, I upgraded some things and now it opens the URL without any way of closing it. You have to kill the app.
I have tried many variations of this: window.open('http://cnn.com','_blank','location=yes,toolbar=yes');
myconfig.xml has:
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser" />
</feature>
I get no errors... the page opens... but there is no way to close and return to the app. I have seen a lot of folks putting solutions for URL recognition and making the window close... but I need the childBrowser plugin method... where the user can close the window when he/she is finished viewing the page.
Phonegap 3.0 -
JqueryMobile 1.2 -
IOS 7.0.2 -
xCode 5.0 -
Any help would be greatly appreciated!
Your syntax looks okay, but give these code snippets a try:
Pure JavaScript:
var ref = window.open('http://cnn.com', '_blank', 'location=yes,toolbar=yes');
HTML + JavaScript:
CNN Link
Also, check that you have correctly installed the InAppBrowser plugin (PhoneGap/Cordova 3.0+ need it to be installed separately via the command line). Your config.xml file looks correct, but just make sure that the rest of the plugin is installed properly.
You can use the following commands to list all the installed plugins in your project...
Using Cordova: cordova plugins
Using PhoneGap: phonegap local plugin list
You can also just go to your Desktop, navigate to the 'plugins' folder within your project and check that there is a folder named 'org.apache.cordova.inappbrowser' or 'org.apache.cordova.core.inappbrowser' inside.
To install the InAppBrowser plugin (if necessary)...
Using Cordova: cordova plugin add org.apache.cordova.inappbrowser
Using PhoneGap: phonegap local plugin add org.apache.cordova.inappbrowser
From your description, it sounds like your page is opening within the app's webview, instead of the InAppBrowser window. This is the behaviour you would normally get if you used '_self' instead of '_blank'. Hopefully something here will help fix it.
If you are using PhoneGap Build then you need to use different syntax i.e. (see plugin info):
<gap:plugin name="org.apache.cordova.inappbrowser" />
See also PGB plugin repository. It seem to be up-to-date now. You can see a simple test application for a working version.
Note that this might not be working if you are building yourself (locally on your computer). Use instructions by wicketyjarjar if you are building locally.
The inAppBrowser did not work with Phonegap 3.0.0, and had to change this in config.xml to make it work on both ios and Android :
<plugin name="inAppBrowser">
to
<gap:plugin name="org.apache.cordova.inappbrowser" />
Also if you would want to include emailcomposer use the below line in config.xml
<gap:plugin name="de.appplant.cordova.plugin.email-composer" />
and in the Javascript file add the below lines:
var ops = {
callback: function (result) {
navigator.notification.alert(result);
},
subject: "Look at this photo",
body: "Take a look at <b>this</b>:",
toRecipients: ["example#email.com", "johndoe#email.org"],
ccRecipients: [],
bccRecipients: [],
isHTML: true,
attachments: ["_complete_path/image.png"]
}
function mail(name, url) {
window.plugin.email.open({
to: [],
cc: [],
bcc: [],
subject: name,
body: url,
isHtml: true
});
}
I had the same problem. In my case it was caused by forgetting to include the cordova.js script.
<script type="text/javascript" src="cordova.js"></script>

How to separate gwt modules using <script> tag, and still use dev mod

I'm rewriting my question to be more detailed and more clear.
i have a project like this:
com.mycompany.modulue1
------------------------------------>client
------------------------------------>server
------------------------------------>shared
------------------------------------>module1.gwt.xml
com.mycompany.modulue1
------------------------------------>client (JSNI - create a method to access methods in module2)
------------------------------------>server
------------------------------------>shared
------------------------------------>module2.gwt.xml (using add-linker name="xsiframe")
in module1.html i added the following script:
"script type="text/javascript" language="javascript" src="module2/Module2.nocache.js"
"script type="text/javascript" language="javascript" src="module1/Module1.nocache.js"
now i get "module2" need to be recompiled every time (even if the env. is clean and recently built
the JS method that is defined in module 2 is not defined when the server is up.
i'm using external server in dev mode (for EJB use)
What I'm doing wrong?
Thank you
Ahmad Igbaria
Not sure I fully understand your problem but judging by the title:
If you have a page that loads 2 distinct GWT applications, you can run only one of them in DevMode by subtituting gwt.codesvr in your URL with gwt.codesvr.moduleName, where moduleName is the name of the module to run in DevMode. That way, the other module won't switch to DevMode and will thus run in production mode.
This however only works with the xsiframe linker (for the one module you want to run in Dev Mode at least)
After so much time and headaches, I have found the solution it's very simple, you need to add the linker to both modules not only the one you want to use as a pre-compiled!

GWT project unable to load **.nocache.js in the default html file

Currently I am developing a GWT project by using GWT 2.4.0 in eclipse 3.7. I deploy the app inside Tomcat 7. It run perfectly for the past 2 months.
However, now I am running into a problem which I unable to trace the problem. Here is the source code for "welcomeGWT.html".
<!doctype html>
<!--
The DOCTYPE declaration above will set the browser's rendering engine into
"Standards Mode". Replacing this declaration with a "Quirks Mode" doctype may
lead to some differences in layout.
-->
<html>
<head>
<meta name='gwt:module' content='com.haircare101.cesapp.Main=com.haircare101.cesapp.Main'>
<title>101 HairCare: Customer Excellence System</title>
</head>
<body>
<script type="text/javascript" src="com.haircare101.cesapp.Main/com.haircare101.cesapp.Main.nocache.js"></script>
</body>
</html>
As the tomcat started, I type the corresponding URL into browser and it shows me this page with no error (no error shows inside Tomcat log files). But it unable to direct me to the specified GWT Main Entry Point (I saw this source file when I can "View Source" of browser).
** I have no compilation error, no deployment error or no runtime error.
Can anybody tells me the reason why it stuck in this page? Many thanks and appreciate!
Cheers,
Ryan C.
Besides using google chrome, enable firebug to debug your javascript and find out what's wrong. Apparently you have an array acess problem.
Most probably, it is in your GWT entry point and not in javascript (don't forget that all the client package code is transformed into javascript)