Plugin generator VAR OPERATOR | Генератор плагинов переменная OPERATOR - Forum

Forum Navigation
You need to log in to create posts and topics.

Plugin generator VAR OPERATOR | Генератор плагинов переменная OPERATOR

Переменная OPERATOR  не передает значение, на любой указанный оператор я всегда получаю ошибку
The OPERATOR variable does not pass a value, for any specified operator I always get an error

Uncaught SyntaxError: Unexpected token '=='
jquery.min.js:2  Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.8.2/$injector/modulerr?p0=NeoApp&p1=Error%3A%20%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.8.2%2F%24injector%2Fnomod%3Fp0%3DNeoApp%0A%20%20%20%20at%20file%3A%2F%2F%2FC%3A%2FUsers%2Fuser%2FDocuments%2FVisualNeoWeb%2FLibraries%2Fjs%2Fneogular.js%3A1%3A663%0A%20%20%20%20at%20file%3A%2F%2F%2FC%3A%2FUsers%2Fuser%2FDocuments%2FVisualNeoWeb%2FLibraries%2Fjs%2Fneogular.js%3A1%3A171335%0A%20%20%20%20at%20ma%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fuser%2FDocuments%2FVisualNeoWeb%2FLibraries%2Fjs%2Fneogular.js%3A1%3A169875)%0A%20%20%20%20at%20file%3A%2F%2F%2FC%3A%2FUsers%2Fuser%2FDocuments%2FVisualNeoWeb%2FLibraries%2Fjs%2Fneogular.js%3A1%3A171111%0A%20%20%20%20at%20file%3A%2F%2F%2FC%3A%2FUsers%2Fuser%2FDocuments%2FVisualNeoWeb%2FLibraries%2Fjs%2Fneogular.js%3A1%3A14771%0A%20%20%20%20at%20lt%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fuser%2FDocuments%2FVisualNeoWeb%2FLibraries%2Fjs%2Fneogular.js%3A1%3A1061)%0A%20%20%20%20at%20i%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fuser%2FDocuments%2FVisualNeoWeb%2FLibraries%2Fjs%2Fneogular.js%3A1%3A14621)%0A%20%20%20%20at%20Lt%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fuser%2FDocuments%2FVisualNeoWeb%2FLibraries%2Fjs%2Fneogular.js%3A1%3A16691)%0A%20%20%20%20at%20i%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fuser%2FDocuments%2FVisualNeoWeb%2FLibraries%2Fjs%2Fneogular.js%3A1%3A7952)%0A%20%20%20%20at%20r%20(file%3A%2F%2F%2FC%3A%2FUsers%2Fuser%2FDocuments%2FVisualNeoWeb%2FLibraries%2Fjs%2Fneogular.js%3A1%3A8266)

 

 

@lolo
To be honest, I’ve never used that kind of variable. I’m not even sure what Dave originally intended to do with the OPERATOR variable. It’s quite possible that he never finished implementing it.
Do you find it useful in any particular way?

@lolo
Честно говоря, я никогда не использовал переменные такого типа. Мне даже не совсем понятно, что Дэйв изначально планировал сделать с переменной OPERATOR. Вполне возможно, что он так и не довёл её реализацию до конца.
Вы находите её полезной в каком-то конкретном случае?

@luishp
Я хотел использовать ее для компонента прослушивания скроллинга, я сделал так, но оказывается, проблема со скроллингом только начинается. Оказывается, что у приложений VisualNeoWeb  window.scrollY всегда равен 0, то есть скроллинг осуществляется иначе.

@luishp
I wanted to use it for the scrolling listener component, I did so, but it turns out the problem with scrolling is just beginning. It turns out that for VisualNeoWeb applications, window.scrollY is always equal to 0, that is, scrolling is carried out differently.

function pvv_scrolling_page(number, onOperator, onTrue, onFalse) {
  if (typeof onTrue !== 'function') onTrue = () => {};
  if (typeof onFalse !== 'function') onFalse = () => {};

  const ops = {
   '>': (a, b) => a > b,
   '<': (a, b) => a < b,
   '>=': (a, b) => a >= b,
   '<=': (a, b) => a <= b,
   '==': (a, b) => a > b,
   '!=': (a, b) => a < b,
   '===': (a, b) => a >= b,
   '!==': (a, b) => a <= b
  };

  function handleScroll() {
    if (ops[onOperator](window.scrollY, number)) {
      onTrue();
    } else {
      onFalse();
    }
  }

  window.addEventListener('scroll', handleScroll);
};