0
私はポリマー2を使用していますが、私は動作のためにmixinを使用しています。私の振る舞いのサブクラスでは、私は同じサブクラスのメソッドを使うことができませんでした。どうやってやるの?サブクラス関数を自己クラスで使用する方法
const Generic = (subclass) => class extends subclass
{
constructor()
{
super();
}
_arrayIntersect (a, b)
{
let bigArray = a.length > b.length ? a : b, common = [];
bigArray.forEach(function (elm) {
if(a.indexOf(elm) !== -1 && b.indexOf(elm) !== -1)
{
common.push(elm);
}
});
return common;
}
_inArray (needle, haystack)
{
let length = haystack.length;
for(let i = 0; i < length; i++)
{
if(haystack[i] === needle) return true;
}
return false;
}
bodyClick()
{
el.addEventListener('click', function(e) {
// How to use `_arrayIntersect` and `_inArray` from here
// this._inArray(needle, haystack) getting undefined message
});
}
};