With the following code:
Template.home.rendered = function() {
$("#newsfeed").tinyscrollbar();
};
calling the plugin from this meteor packaging of tinyscrollbar
I get the following exception:
Exception from Deps afterFlush function
function: TypeError: Cannot read property 'offsetHeight' of undefined
at Scrollbar.update
(a full trace is at this pastebin)
I will be happy to provide more information as needed!
Did you add all the required html to your page?
Related
chrome.tabs.create({cookieStoreId:"4"})
When i am trying to use above code in chrome extension it is showing following error:
Uncaught TypeError: Error in invocation of tabs.create(object createProperties, optional function callback): Error at parameter 'createProperties': Unexpected property: 'cookieStoreId'.
at :1:13
I am following documentation of :
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/create
https://docs.w3cub.com/web_extensions/api/tabs/create
I have also included permissions of cookies in manifest.
I'm modifying my application to use nodejs and browserify via gulp to produce one minified js.
I've switched from loading dependencies manually and updating manually to installing them with npm.
Everything went smooth, but when I wanted to install select2 it started throwing errors all over the place. When I moved my removed manual updated file for the npm required() file.
jquery.js:3841 jQuery.Deferred exception: o(...).select2 is not a function TypeError: o(...).select2 is not a function
at i.init (https://www.example.com/newstyle/js/closure.js?time=1559747711:1:5612)
at i.sysInit (https://www.example.com/newstyle/js/closure.js?time=1559747711:1:108153)
at i (https://www.example.com/newstyle/js/closure.js?time=1559747711:1:106602)
at new i (https://www.example.com/newstyle/js/closure.js?time=1559747711:1:5333)
at HTMLSelectElement. (https://www.example.com/newstyle/js/closure.js?time=1559747711:1:108496)
at Function.each (https://www.example.com/newstyle/js/closure.js?time=1559747711:1:200628)
at _.fn.init.each (https://www.example.com/newstyle/js/closure.js?time=1559747711:1:199273)
at _.fn.init.d.fn.(anonymous function) [as FormDropdownHandler] (https://www.example.com/newstyle/js/closure.js?time=1559747711:1:108384)
at HTMLDocument. (https://www.example.com/newstyle/js/closure.js?time=1559747711:1:108696)
at HTMLDocument.dispatch (https://www.example.com/newstyle/js/closure.js?time=1559747711:1:240241) undefined
dropdown.module.js:53 Uncaught TypeError: o(...).select2 is not a function
at i.init (dropdown.module.js:53)
at i.sysInit (oc.foundation.base.js:157)
at i (oc.foundation.base.js:20)
at new i (dropdown.module.js:19)
at HTMLSelectElement. (oc.foundation.base.js:191)
at Function.each (jquery.js:367)
at _.fn.init.each (jquery.js:202)
at _.fn.init.d.fn.(/anonymous function) [as FormDropdownHandler] (https://www.example.com/newstyle/js/closure.js?time=1559747711:1:108384)
at HTMLDocument. (oc.foundation.base.js:213)
at HTMLDocument.dispatch (jquery.js:5237)
The code I'm using is:
<select name="pickup_point">
<option value="1" >all work</option>
<option value="4" >no play</option>
<option value="5" >dull boy</option>
</select>
and the javascript:
$ = require('jquery');
require('select2');
$(document).ready(function(){
$('select').select2();
});
How can I get select2 working when I require it in the index.js file?
Took me a while to piece together what goes wrong here.
It comes down to that Select2 uses it's own loader and factory function to initialize itself, which doesn't get called by default. You need to call it manually.
If you have a window object and registered jQuery to the window object you can call Select2 as follows once in your main javascript file:
window.$ = window.jQuery = require('jquery);
require('select2')();
or if you prefer variables instead of calling the function on require directly:
window.$ = window.jQuery = require('jquery);
var select2Initialisator = require('select2');
select2Initialisator();
If you like to work with scopes or different versions of jQuery, you can also pass the jQuery instance you wish to register the select2 to, to select2 factory constructor as follows
var jQuery = require('jquery');
require('select2')(jQuery);
I'm just diving into ember addons and node so this is probably a bit of a newb question. I'm also coming from a rails/lisp background so I love dropping a repl into my code to poke around at run-time. I've tried using node's repl but it seems like it's not blocking and the program is running to completion.
Setup
I'm trying to run an ember generator for an addon:
ember g addon test-addon
which is failing with this error message:
TypeError: Cannot read property 'name' of undefined
at Class.module.exports.generateBowerJson (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/blueprints/addon/index.js:62:33)
at Class.module.exports.files (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/blueprints/addon/index.js:108:10)
at Class.Blueprint.supportsAddon (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/lib/models/blueprint.js:783:15)
at Class.module.exports.Task.extend.run (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/lib/tasks/generate-from-blueprint.js:25:98)
at Class.module.exports.Command.extend.run (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/lib/commands/generate.js:79:17)
at Class.<anonymous> (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/lib/models/command.js:136:17)
at lib$rsvp$$internal$$tryCatch (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:489:16)
at lib$rsvp$$internal$$invokeCallback (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:501:17)
at lib$rsvp$$internal$$publish (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:472:11)
at lib$rsvp$asap$$flush (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1290:9)
at process._tickDomainCallback (node.js:381:11)
I look in node_modules/ember-cli/blueprints/addon/index.js and find where I think the problem is. So, I add this code hoping to get a repl with the prompt hi>:
var replServer = repl.start({
prompt: 'hi >',
input: process.stdin,
output: process.stdout,
}).on('exit', function() {
delete contents.private;
contents.name = this.project.name();
^ this seems to be the problem
rest of original code ...
But, when I run ember g addon test-addon again, it just blows by the prompt and the program exists with the same error:
$ember g addon test-addon
version: 0.2.5
hi >Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
at Class.module.exports.generateBowerJson (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/blueprints/addon/index.js:58:33)
at Class.module.exports.files (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/blueprints/addon/index.js:104:10)
at Class.Blueprint.supportsAddon (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/lib/models/blueprint.js:783:15)
at Class.module.exports.Task.extend.run (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/lib/tasks/generate-from-blueprint.js:25:98)
at Class.module.exports.Command.extend.run (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/lib/commands/generate.js:79:17)
at Class.<anonymous> (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/lib/models/command.js:136:17)
at lib$rsvp$$internal$$tryCatch (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:489:16)
at lib$rsvp$$internal$$invokeCallback (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:501:17)
at lib$rsvp$$internal$$publish (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:472:11)
at lib$rsvp$asap$$flush (/Users/dixon/ember-cli/todo-mvc/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1290:9)
at process._tickDomainCallback (node.js:381:11)
Any help would be greatly appreciated. Thanks!
I am using Browserify to wrap everything up. I have just upgraded from 1.2.23 to 1.3.0 and am now getting the following errors:
Firefox Error
TypeError: angular.module is not a function
var app = angular.module('login-Controller', ['Views']);
----------^
Clearly says that angular is not defined. So I outputed the output from angular
var angular = require('angular'),
console.info(angular); // Object {} ='s an empty object
Does this mean that angular is no longer compatible with browserify? If it is, how can I get it working?
Detailed Error from Chrome
Uncaught TypeError: undefined is not a function main.js:25868 C:\var\www\stage.mayfieldafc.com\src\site\js\users\loginCntrl.js.angularmain.js:1 smain.js:1 (anonymous function)main.js:28 ./src/site/js/app.js.angularmain.js:1 smain.js:1 emain.js:1 (anonymous function)
main.js:183 Uncaught Error: [$injector:modulerr] Failed to instantiate module mays due to:
Error: [$injector:nomod] Module 'mays' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.3.0/$injector/nomod?p0=mays
at http://localhost:3000/js/main.js:183:12
at http://localhost:3000/js/main.js:1900:17
at ensure (http://localhost:3000/js/main.js:1824:38)
at module (http://localhost:3000/js/main.js:1898:14)
at http://localhost:3000/js/main.js:4167:22
at forEach (http://localhost:3000/js/main.js:438:20)
at loadModules (http://localhost:3000/js/main.js:4151:5)
at createInjector (http://localhost:3000/js/main.js:4077:11)
at doBootstrap (http://localhost:3000/js/main.js:1587:20)
at bootstrap (http://localhost:3000/js/main.js:1608:12)
http://errors.angularjs.org/1.3.0/$injector/modulerr?p0=mays&p1=Error%3A%20…at%20bootstrap%20(http%3A%2F%2Flocalhost%3A3000%2Fjs%2Fmain.js%3A1608%3A12)main.js:183 (anonymous function)main.js:4190 (anonymous function)main.js:438 forEachmain.js:4151 loadModulesmain.js:4077 createInjectormain.js:1587 doBootstrapmain.js:1608 bootstrapmain.js:1502 angularInitmain.js:25682 (anonymous function)main.js:2845 triggermain.js:3116 eventHandler
Markup
html(ng-app='mays)
As mentioned by #JeffB, you can use browserify-shim to (hopefully temporarily) remedy this problem.
First, npm install --save-dev browserify-shim. Then, add the following to your package.json:
"browserify": {
"transform": [
"browserify-shim"
]
},
"browser": {
"angular": "./node_modules/angular/angular.js"
},
"browserify-shim": {
"angular": "angular"
}
This should then let you require and access Angular as expected.
The problem is that angular haven't updated their npm packages to be compatible with browserify just yet.
My fix was disgusting but its working. I simply downloaded v1.3.0 and pasted it into:
node_modules\angular\lib\angular.min.js
Now browserify will compile and use the latest version. This I hope is a temporary fix until they update the package.
It looks like you're defining the module name to be 'login-Controller' in your script, but calling it 'mays' in your markup. I would expect to see something like this:
//declare app in main.js
angular.module('name-of-app', [<modules>])
<!-- call your app in markup -->
<html ng-app="name-of-app"></html>
//jade
html(ng-app='name-of-app')
Using touch 2.1.0 and Cmd 3.1.2.342
Whilst trying to create a production version of my sencha app, I get the following error:
[WRN] C1003: Unsupported Ext.define syntax -- C:\wamp\www\touch-2.1.0\axis\nativ
e\appname\touch\src\fx\TimingFunctions.js:109
[ERR] C2008: Requirement had no matching files (Ext.fx.TimingFunctions) -- C:\wa
mp\www\touch-2.1.0\axis\native\appname\touch\src\fx\Abstract.js:959
[ERR] The following error occurred while executing this line:
C:\wamp\www\touch-2.1.0\axis\native\appname.sencha\app\build-impl.xml:165:
It seems to me that it is saying a file called fx/TimingFunctions.js is required by fx/Abstract.js but cannot be found. However, this can't be what it means as the file exists in that folder.
The command I am using is:
sencha app build production
Line 109 of TimingFunctions.js looks like this:
Ext.define('Ext.fx.TimingFunctions', Ext.apply({
singleton: true,...
One solution is to change line 109 of TimingFunctions.js from:
Ext.define('Ext.fx.TimingFunctions', Ext.apply({
to:
Ext.define('Ext.fx.TimingFunctions', {
and change line 136 of the same file from:
}, EasingPrototype));
to:
}, EasingPrototype);
This then allows the build to go ahead.
However, when I then view the production app in the web browser, it freezes and I get the following error
Uncaught TypeError: Object # has no method 'call' process sencha-touch-all-debug.js:6767
(anonymous function) process sencha-touch-all-debug.js:6774
(anonymous function) sencha-touch-all-debug.js:6779
Ext.apply.onBeforeCreated sencha-touch-all-debug.js:5196
process sencha-touch-all-debug.js:5262
process sencha-touch-all-debug.js:5268
process sencha-touch-all-debug.js:5268
process sencha-touch-all-debug.js:5268
Ext.apply.process sencha-touch-all-debug.js:5272
Ext.Class.ExtClass sencha-touch-all-debug.js:5183
Ext.ClassManager.create sencha-touch-all-debug.js:6725
Ext.apply.define sencha-touch-all-debug.js:7407
(anonymous function) TimingFunctions.js?_dc=1379403994382:109
(anonymous function) TimingFunctions.js?_dc=1379403994382:138
There was a spelling mistake in the files fx/Abstract.js and fx/TimingFunctions.js
Actually, it's not a spelling mistake - more like a grammatical error.
Abstract.js calls a function in TimingFunctions.js. in Abstract.js it is referred to as EasingMap, where as in TimingFunctions.js it is called easingMap