These are chat archives for ractivejs/ractive

23rd
Nov 2017
kouts
@kouts
Nov 23 2017 07:01
js is not only download time but compile time too, I guess it depends on the project. In my daily job I'm using Ractive to build the frontend for an enterprise portal. There are a lot of rules, user permissions, field properties etc that simply cannot fit into the frontend.
Business logic that is...
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 09:45
hmm. I got it. so you don't think that a front end application is not powerful, accurate, reliable (in terms of working); but there would be authorization issues if you move the business logic to the client side because it's wide open to hacking (just right click a webapp, edit, there you go)?
@fskreuz I'm experiencing a weird situation. I have two components which are placed side by side. they both tries to fire myEvent, one can fire, other (Foo) can not. I'm pretty sure I can not reproduce it. what would you suggest?
<hey on-click="myEvent" />  <!-- this can fire --> 
<Foo on-error="myEvent" /> <!-- this can not -->
in Foo's onrender, I placed another handler to see if it is working internally, and it works:
Foo = Ractive.extend({
  ...
  onrender: function(){
    this.on({
      hello: function(){ 
        debugger;
        this.fire('error'); // this does not fire error 
       }
    });
    this.fire('hello'); // this fires hello
  }
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 09:54
this component was working correctly before my lots and lots of changes on other functions
kouts
@kouts
Nov 23 2017 10:04
@ceremcem it's not only reliability thing, it's just that business logic is so complicated that if anyone wanted to transfer it into frontend he/she would have to write js code for an eternity :laughing:
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 10:28
:)
kouts
@kouts
Nov 23 2017 10:29
or "until the Sun burns down", as we say
:laughing:
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 10:30
actually I'm doing this :)
kouts
@kouts
Nov 23 2017 10:32
Do you have a project from start or something that existed before?
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 10:32
I've built this from scratch. it's by design
kouts
@kouts
Nov 23 2017 10:33
ah ok then
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 10:54
@fskreuz I solved the problem: Playground
is that (onrender/oncomplete behaviour) intended?
Joseph
@fskreuz
Nov 23 2017 12:36
@ceremcem Hmm... that's strange. It probably has to do with the order of registration of the events. tbh, I rarely use onrender to setup event listeners. I use oninit, which happens earlier, and independent of DOM things. :grin:
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 12:39
the problem with oninit is that I need to interact with some of the DOM (sub-components) so the easiest method is finding them onrender, and use them in the handlers (for example, trigger the other component's event)
but this might be wrong, tho
Joseph
@fskreuz
Nov 23 2017 12:45
This does seem like a bug tho. I would think onrender would do fine as long as the parent registered using an earlier hook (i.e. with oninit). Also... it works in 0.7! :tada:
Feel free to write up an issue tho. :grin:
:coffee: break :sleepy:
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 12:50
hmm. ok, ractivejs/ractive#3148
kouts
@kouts
Nov 23 2017 15:49
@ceremcem I used to also put the events in oninit like @fskreuz but now have refactored to use theon: { ... }attr available
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 15:51
@kouts how do you interact with any other component in an event handler, when you declared it in on: {...}?
for example, you have a dropdown and a button in a component. you want to make the button clicked when an item is selected in the dropdown, what would you do?
kouts
@kouts
Nov 23 2017 15:53
I usually don't need to interact with any other component on instatiation, this usually happens e.g in a click handler etc. If you need this behavior maybe the safest place would be in the oncomplete
vetsinen
@vetsinen
Nov 23 2017 16:39
hello, reactivists
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 16:39
hello! (this is me since I'm reacting)
vetsinen
@vetsinen
Nov 23 2017 16:41
can anybody advice how to get index for list of buttons?
as i have a list of buttons
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 16:43
@vetsinen you are sure that you are on the correct list, right? this room is for Ractive (related) talks, not React.
kouts
@kouts
Nov 23 2017 16:54
:smile:
vetsinen
@vetsinen
Nov 23 2017 16:59
sure
if it's react i will solve
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 17:00
:)
vetsinen
@vetsinen
Nov 23 2017 17:00
but reactive is pretty strange and wierd
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 17:00
hmm. okay. it's Ractive (not Reactive) and let me help you. What do you need?
(exactly?)
vetsinen
@vetsinen
Nov 23 2017 17:02
hmm. i just detected that framework is called ractive...
Cerem Cem ASLAN
@ceremcem
Nov 23 2017 17:04
no problem. do you need something like this?
Joseph
@fskreuz
Nov 23 2017 23:59
@ceremcem pls try this fix ractivejs/ractive#3149 :grin: