27 questions
0
votes
1
answer
96
views
Unit testing private methods and event listeners in TypeScript class hierarchy
I'm new to writing unit tests for private methods and I've been researching how to approach this in TypeScript. However, I couldn't find a solution that fits my scenario.
Here's a simplified version ...
0
votes
1
answer
2k
views
It's good practice to use class inheritance for components in Angular? What about nested inheritance? [closed]
If I have some classes like this:
common.ts (under mixins folder):
export class Common { }
base-component.ts:
@Mixin([Validation])
export abstract class BaseComponent extends Common implements ...
1
vote
1
answer
2k
views
how to manage super() constructor parameters in javascript
This is a short piece of code from mazeContainer.js with only necessary part-
import Cell from "./cell.js";
import Player from "./player.js";
export default class Maze {
....
...
0
votes
2
answers
448
views
Javascript Object constructor override to stop certain methods be called
A global object as such “Obj” is created:
Obj = {
gtm : {},
method: function(){console.log("Method is called");}
};
In some other places Obj.method() is used.
My question is can I extend ...
1
vote
2
answers
842
views
Getting React flow error: module is not a polymorphic type. How to extend a class?
I am trying to extend my existing layout to basically override the method renderHeader() but flow doesn't like it:
module ./Layout [1] is not a polymorphic type.
how do I fix this?
here is a ...
-3
votes
2
answers
159
views
JS inheritance - MDN article
given MDN JS Inheritance article, we have these lines
My question is, why use Object.create and not just Person.prototype?
I understand the need to link prototypes.
But here is console example ...
1
vote
1
answer
684
views
ES6 `static get length()` is not inherited as expected
I'm having an issue with providing a static getter function for the length property of my ES6 class extends.
As it turns out the actual Function.length getter always takes precedence over my own ...
0
votes
1
answer
3k
views
How to run javascript only after the view has loaded in Odoo 10
I installed web hide menu on https://www.odoo.com/apps/modules/8.0/web_menu_hide_8.0/
I modified to use it on Odoo 10, but the form will be adjusted to full width IF we press the hide button, if we ...
2
votes
1
answer
3k
views
AngularJS: changing $rootScope variable doesn't change first selected option in ng-model
I have a specific problem which I can't seem to crack.
In html I have following code:
<select ng-model="$parent.proizvod" ng-options="i.id_proizvod as i.proizvod for i in proizvodiServer">
...
0
votes
2
answers
247
views
Confusion With Javascript Inheritance
I'm confused about javascript inheritance.
Consider the following code:
function parent(firstname, lastname) {
this.firstname = firstname || "abc";
this.lastname = lastname || "def";
}
...
0
votes
1
answer
292
views
How to set a function's prototype
I am trying to understand Javascript's prototype. I know I can add functions to prototype individually Calculator.prototype.calculate = function(){};, however when I tried setting a new prototype ...
0
votes
1
answer
46
views
Clarification on Prototype and Object.create pattern
<html>
<head>
<meta charset="UTF-8">
<title>Animal</title>
<script type="text/javascript" >
var Animal = function () {...
5
votes
1
answer
409
views
ES6 Class extending native type makes instanceof behave unexpectedly in some JavaScript engines?
Consider the following ES6 Classes:
'use strict';
class Dummy {
}
class ExtendDummy extends Dummy {
constructor(...args) {
super(...args)
}
}
class ExtendString ...
0
votes
2
answers
141
views
Javascript sub classing, super constructors and using custom extend loses base class methods
In another SO question about whether to call a super-constructor or use the prototype chain the answer provided by one of the users seemed sensible but didn't work for me when I implemented it on my ...