Titanium : uncaught type error - javascript

var menu = Titanium.UI.Android.OptionMenu.createMenu();
what it come up with when on the emulator it says
Message: uncaught TypeError: Cannot call method 'createMenu' of undefined
source: var menu = Titanium.UI.Android.OptionMenu.CreateMenu();
if you know what this all means would you be able to explain and help fix the problem.

Titanium.UI.Android doesn't have OptionMenu object.
Check documentation and describe what you are trying to do with more details.

The problem is Ti.UI.Android module doesn't have an OptionMenu object. If you want to create a menu, you can use Titanium.Android.Menu module.

Related

TypeError: elem[prop] is not a function in Webdriveio

TypeError: elem[prop] is not a function
E2E testing in webdriveio. I want to click a button inside an iframe.
let iframe = browser.$('#fullmessage')
browser.pause(1000)
browser.switchToFrame(iframe)
browser.setTimeout({ implicit: 10000 })
let clickAgree = $('a[class="button is-success"]')
clickAgree.click()
browser.switchToParentFrame()
browser.pause(3000)
I was facing same error and when debug more using REPL found that the issue could be due to 2 reasons:
selector is returning array of elements and so it was not able to call the method used.
the method being called on element does not supports.
For example with following code:
$('.some_class').$$('input').getValue();
was getting error - Uncaught Error: elem[prop] is not a function. Using $('.auto_test_class').$$('input')[1].getValue(); works. But its better to use some Id or xpath.
Hope this might be useful for someone facing same issue :)
Hi i faced with the same problem, but in async. The reason is that you need
to await already defined element as parameter:
get iframe() { return $('.iframe'); }
await browser.switchToFrame(await this.iframe);
Because switchToFrame works only with element, not with promise.
Maybe for someone it will be useful.

Uncaught TypeError: icon.hasName is not a function

I'm getting a console error "Uncaught TypeError: icon.hasName is not a function" when I'm using my mobile navigation using the hamburger menu and I'm not sure how to get rid of this or solve it. Any ideas?
you have to create the function .addName first and tell it what to do so it can carry it out on the varyable also you may be able do get to work by changing it to addName(icon)
this makes sure the function is applied to the variable

Keccak on react-native

I trying the ethereumjs-util in react-native , first ethUtil.privateToPublic work fine, then when use ethUtil.publicToAddress will getting this error TypeError: Cannot read property 'call' of undefined , I trace the error actually come from Keccak.
Then I try Keccak it self :
const createKeccakHash = require('keccak');
console.log(createKeccakHash('keccak256').digest().toString('hex'));
also getting the same error TypeError: Cannot read property 'call' of undefined
You can try use js-sha3 I know that it maybe your module doesn't support React Native.
keccak256 = require('js-sha3').keccak256;
var bytes = keccak256.digest();
console.log(bytes);

Uncaught TypeError: $(...).froalaEditor is not a function// solution is found but not sure how to use it

I just simply want to use froala text editor on my site, but I get Uncaught TypeError: $(...).froalaEditor is not a function.
I googled it and found the solution here but I don't know how to use this source. Mainly because I don't have this anywhere in my code
var $ = require('jquery');
require('node_modules/froala-editor/js/froala_editor.min.js');
$(function() {
var $target = $('<div>').appendTo('body');
$target.froalaEditor()
});
I simply followed the documentation, https://github.com/froala/wysiwyg-editor. I used {{form.media}} at the top to use it but on console I get the above mentioned error. Can someone please tell me how to use the solution in github?
require('node_modules/froala-editor/js/froala_editor.min.js')($);
You see at the end?

Backbone.js error when trying to set model attribute to same value

I keep getting the same error when I try to set an attribute but only if the attribute's value already the same as the value I am trying to set it to:
Uncaught TypeError: Object function (obj) { return new wrapper(obj); } has no method 'has'
For example I have the following line:
var s = new SampleModel({"language": "en"});
s.set("language", "en") // this produces the above error
Anyone have any insight into this problem? I am currently using the most recent version of Backbone.js 0.9.1
#ggreiner and #nikoshr are right... they should have posted answers instead of comments, though.
this error is caused by having an outdated version of Underscore.js. you need to upgrade it to v1.3.1 for use with Backbone v0.9.x
http://documentcloud.github.com/underscore/

Categories

Resources