Error with Humanizer.Js - javascript

I recently tried Humanizer.Js. I added a nuget reference of the same from here, and added it in my page as <script src="~/Scripts/humanizer/humanizer.js"></script>.
However in my page load I am getting an error:
"Uncaught TypeError: Cannot read property 'prototype' of undefined" at humanizer.js:409. The stack trace looks like below:
Uncaught TypeError: Cannot read property 'prototype' of undefined
__extends # humanizer.js:409
(anonymous function) # humanizer.js:416
Humanizer.Configuration.Humanizer.Configuration # humanizer.js:422
Humanizer # humanizer.js:424
(anonymous function) # humanizer.js:426
I have also created a plunk here to replicate the error. Also note that .humanize() also doesn't work.
Any suggestions?

I just released version 1.5 on NuGet, should fix your error

Related

Error in audioDetect.js of MIDI.js (midicube)

I'm trying to use MIDI.js (because I don't know how else to play MIDI files smoothly when the browser tab is not in focus). More specifically, I'm trying a new version of MIDI.js called midicube.
Like in the readme, I do
<script src="releases/midicube.js"></script>
<script>
MIDI.loadPlugin({
// this only has piano.
// for other sounds install the MIDI.js
// soundfonts somewhere.
soundfontUrl: "./examples/soundfont/",
onerror: console.warn,
onsuccess: () => {
MIDI.noteOn(0, 60, 0);
}
});
</script>
but I get
audioDetect.js:38 Uncaught TypeError: Cannot read properties of null (reading 'appendChild')
at s (audioDetect.js:38:22)
at audioDetect.js:106:9
at Module.$t (index.js:94:5)
at mytest.html:3:6
s # audioDetect.js:38
(anonymous) # audioDetect.js:106
$t # index.js:94
(anonymous) # mytest.html:3
audioDetect.js:36 Uncaught TypeError: Cannot read properties of null (reading 'removeChild')
at Audio.<anonymous> (audioDetect.js:36:8)
Here are the lines of code that cause the error. Am I doing something wrong or is midicube outdated in some way (latest commit 3 years ago)?

Why is the vanilla JS example for RxDB not working

I've followed the instructions at GitHub, but the example doesn't work.
The app shows "Starting database".
At the browser console there is this error:
Uncaught (in promise) TypeError: storage is undefined
_callee6$ http://127.0.0.1:20202/dist/rxdb.browserify.js:11032
tryCatch http://127.0.0.1:20202/dist/rxdb.browserify.js:70936
invoke http://127.0.0.1:20202/dist/rxdb.browserify.js:71167
defineIteratorMethods http://127.0.0.1:20202/dist/rxdb.browserify.js:70992
asyncGeneratorStep http://127.0.0.1:20202/dist/rxdb.browserify.js:14068
_next http://127.0.0.1:20202/dist/rxdb.browserify.js:14090
_asyncToGenerator http://127.0.0.1:20202/dist/rxdb.browserify.js:14097
_asyncToGenerator http://127.0.0.1:20202/dist/rxdb.browserify.js:14086
_createRxDatabaseStorageInstances http://127.0.0.1:20202/dist/rxdb.browserify.js:11060
createRxDatabaseStorageInstances http://127.0.0.1:20202/dist/rxdb.browserify.js:11017
_callee7$ http://127.0.0.1:20202/dist/rxdb.browserify.js:11075
tryCatch http://127.0.0.1:20202/dist/rxdb.browserify.js:70936
invoke http://127.0.0.1:20202/dist/rxdb.browserify.js:71167
defineIteratorMethods http://127.0.0.1:20202/dist/rxdb.browserify.js:70992
asyncGeneratorStep http://127.0.0.1:20202/dist/rxdb.browserify.js:14068
_next http://127.0.0.1:20202/dist/rxdb.browserify.js:14090
_asyncToGenerator http://127.0.0.1:20202/dist/rxdb.browserify.js:14097
_asyncToGenerator http://127.0.0.1:20202/dist/rxdb.browserify.js:14086
_prepare http://127.0.0.1:20202/dist/rxdb.browserify.js:11104
prepare http://127.0.0.1:20202/dist/rxdb.browserify.js:11064
createRxDatabase http://127.0.0.1:20202/dist/rxdb.browserify.js:11142
<anonymous> http://127.0.0.1:20202/main.js:33
When I try to add a hero and click the "Insert" button this error appears at the console:
Uncaught ReferenceError: col is not defined
addHero http://127.0.0.1:20202/main.js:97
onclick http://127.0.0.1:20202/:1
Ist this a bug or am I missing something?
According to the rxdb v10 release notes:
"...many (example projects) are outdated and need updates."
I was as well not able to get it working.

uncaught TypeError: Cannot read property 'substr' of undefined ionic

Suddenly im getting error when i start ionic project
TypeError: Cannot read property 'substr' of undefined
at Function.<anonymous> (D:\Work\Prince\TakeToTake\node_modules\source-map\lib\source-node.js:115:26)
at Array.forEach (native)
at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (D:\Work\Prince\TakeToTake\node_modules\source-map\lib\sour
at Function.SourceNode_fromStringWithSourceMap [as fromStringWithSourceMap] (D:\Work\Prince\TakeToTake\node_modules\source-map\lib
at SourceMapSource.node (D:\Work\Prince\TakeToTake\node_modules\webpack-sources\lib\SourceMapSource.js:39:21)
at ReplaceSource.node (D:\Work\Prince\TakeToTake\node_modules\webpack-sources\lib\ReplaceSource.js:70:30)
at CachedSource.node (D:\Work\Prince\TakeToTake\node_modules\webpack-sources\lib\CachedSource.js:18:24)
at D:\Work\Prince\TakeToTake\node_modules\webpack-sources\lib\ConcatSource.js:37:50
at Array.map (native)
at ConcatSource.node (D:\Work\Prince\TakeToTake\node_modules\webpack-sources\lib\ConcatSource.js:36:63)
Please Help
Found the error
i was implement two Component inside one TS file that's why the nodeJS confuse to run which component
now i created another ts file to implement the component
thanks for the comments

l20n.js: Uncaught (in promise) TypeError: element.querySelectorAll is not a function(…)

I'm using Mozilla's l20n.js v. 3.5.0
<script defer src="/bower_components/l20n/dist/compat/web/l20n.js"></script>
and get a serious error, when script tries to parse the page.
l20n.js:2274 Uncaught (in promise) TypeError: element.querySelectorAll is not a function(…)
getTranslatables # l20n.js:2274
_translateFragment # l20n.js:2341
(anonymous function) # l20n.js:2067
translateRoots # l20n.js:2066
translateView # l20n.js:2623
(anonymous function) # l20n.js:2491
Does anyone experience the same problem? Error thrown in both Chrome and Edge.
There's a bug in the library. It was corrected but the new version is not published yet.
If you want you can correct the JavaScript file directly by replacing the content of translateRoots(), lines 2066-2068, by the following code:
var roots = Array.from(observers.get(view).roots);
return Promise.all(roots.map(function(root) {
_translateFragment(view,root)
}));
Update (26/2/2016): as stated in the comment below, now you just have to move to v3.5.1 or higher. It worked for me with FF, IE11, Chrome.

Angular JS Karma module not found

I get an error message -"ReferenceError: module is not defined" when trying to test angular js code.
test script [testSpec.js]
describe('Project controllers', function() {
beforeEach(module('project'));
describe('ListCtrl', function() {
expect(1).toBe(1);
});
});
I have the following entries in my html file
<script src="angular.min.js"></script>
<script src="angular-resource.min.js"></script>
<script src="angular-mocks.js"></script>
followed by my test script - testSpec.js
I specifically included angular.js and angular-mocks.js again. I get to see the following error message
Chrome 31.0.1650 (Windows 7) Project controllers ListCtrl should create 11 records FAILED
TypeError: Object #<Object> has no method 'apply'
Error: Unknown provider: ProjectsProvider <- Projects
at Error (<anonymous>)
at c:/Angular/angular-phonecat/app/angular.min.js:30:24
at Object.c [as get] (c:/Angular/angular-phonecat/app/angular.min.js:27:310)
at c:/Angular/angular-phonecat/app/angular.min.js:30:109
at c (c:/Angular/angular-phonecat/app/angular.min.js:27:310)
at d (c:/Angular/angular-phonecat/app/angular.min.js:27:444)
at Object.instantiate (c:/Angular/angular-phonecat/app/angular.min.js:29:80)
at c:/Angular/angular-phonecat/app/angular.min.js:53:80
at null.<anonymous> (c:/Angular/angular-phonecat/app/testSpec.js:10:12)
at Object.d [as invoke] (c:/Angular/angular-phonecat/app/angular.min.js:28:464)
Error: Declaration Location
at window.jasmine.window.inject.angular.mock.inject (c:/Angular/angular-phonecat/app/angular-mocks.js:1781:2
Here is the complete error
5) at null.<anonymous> (c:/Angular/angular-phonecat/app/testSpec.js:8:34)\n
at null.<anonymous> (c:/Angular/angular-phonecat/app/testSpec.js:6:2)\n
at c:/Angular/angular-phonecat/app/testSpec.js:2:1
Chrome 31.0.1650 (Windows 7) Project controllers ListCtrl should contain new fields FAILED
TypeError: Object #<Object> has no method 'apply'
Error: Unknown provider: ProjectsProvider <- Projects
I'm suspecting that you're missing some include files in you karma config file. Specifically, make sure you load angular.js.
Did you include angular-mocks.js ?
That should solve your problem.
You need that for it to work.

Categories

Resources