Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 05 08:48
    paulfalgout commented #3209
  • Jan 19 01:34
    Purlicue commented #3209
  • Dec 20 2019 15:18

    paulfalgout on master

    Event doc update default value… (compare)

  • Dec 20 2019 15:18
    paulfalgout closed #3674
  • Dec 20 2019 13:03
    coveralls commented #3674
  • Dec 20 2019 13:02
    mochja edited #3674
  • Dec 20 2019 13:01
    mochja opened #3674
  • Oct 21 2019 06:40

    paulfalgout on master

    docs: Fix typos in Class Events… (compare)

  • Oct 21 2019 06:40
    paulfalgout closed #3673
  • Oct 21 2019 01:54
    coveralls commented #3673
  • Oct 21 2019 01:52
    jhwohlgemuth opened #3673
  • Sep 16 2019 01:39
    coveralls commented #3672
  • Sep 14 2019 15:23

    paulfalgout on master

    docs: Fix typo (remove colon) (compare)

  • Sep 14 2019 15:23
    paulfalgout closed #3672
  • Sep 13 2019 23:09
    jhwohlgemuth edited #3672
  • Sep 13 2019 23:08
    jhwohlgemuth commented #3672
  • Sep 13 2019 23:06
    jhwohlgemuth synchronize #3672
  • Sep 12 2019 15:18
    paulfalgout commented #3672
  • Sep 07 2019 02:38
    coveralls commented #3672
  • Sep 07 2019 02:36
    jhwohlgemuth opened #3672
Paul Falgout
@paulfalgout
yeah not used within the library to do anything
dimtabu
@taburetkin
i just not find any use of it, only declaration thats why i thought its an orphan
but after that i goes to the docs and see its a something i don't know before ))
dimtabu
@taburetkin
i start to extend ChildManager and realized that its already used indexOf + splice
so )) i don't know what to improve here
also, i can say that adding a view to the manager is 100 000 ops / sec
setting an array ov views is 200 000 o/s
and removing by view is 300 000 o/s
Mars
@marcelisaac_twitter
Does anyone know how I can self-host with nextcloud?
dimtabu
@taburetkin
Paul, do you know how to debug backbone's tests? i just can't realize how to do that, is it possible at all?
Mars
@marcelisaac_twitter
Have you guys ever used cryptomator?
dimtabu
@taburetkin

what do you think about possibility to listen for dom events like this?

let el = document.createElement('div');
listener.listenToOnce(el, 'click', function(...args){ 
  console.log('CLICK', args, this);
});

i just checkit in codepen with my setInterop and you know what? it works :)

just published v2
John Michael Swartz
@graphographer
I'm wondering if anybody has noticed that the search function isn't working on marionettejs.com
I have a small team that needs to learn mn pretty quickly, and the docs are written such that a search feature is a necessity.
I'm happy to help out, should I just try to fix it and create a pull request?
Paul Falgout
@paulfalgout
I'm not sure why it hasn't gotten 4.1.2 though
ah I think because 4.1.0 technically had some features, but didn't actually update the doc files
Sohan Kumar
@sohankd
Hello everyone. I did some customization to marionette view to add child view behind the scene during rendering of view. But it seems, the child view get rendered twice. One self rendering and another one for showView()
Is there any way which can stop this and will render the view only once ?
Here is m
Sohan Kumar
@sohankd
dimtabu
@taburetkin
@sohankd it depends on version of mn and its pretty hard examine whole your project to detect where is your "error"
so its better you just post minimal code here
Sohan Kumar
@sohankd
@taburetkin hey. Sorry for that. I am using latest version of marionette. Will it be okay if i mention those 2 file here ? And contains less code too,within 20-30 lines.
Sohan Kumar
@sohankd
code

`//Marionette.View.js (Extended)
, render: _.wrap(Marionette.View.prototype.render,function(fn){

        _.bind(fn,this)(); //binds current views 'this' object to render function of Marionette.view  
        this.showChildViews();  //shows all child views declared in childViews object of a view.
    })

,   showChildViews: function()
    {
        if(!_.isEmpty(this.childViews))
        {
            var cViews = Object.entries(this.childViews);

            _.each(cViews || [], (kvPair) => {

                let [region_name,viewFunc] = kvPair;

                if( this.getValidRegion(region_name) )
                {
                    var region = this.getValidRegion(region_name)
                    ,   view = _.isFunction(viewFunc) && this.isView( viewFunc.call(this) ) ? viewFunc.call(this) : undefined;

                    if( view )
                    {
                        this.showChildView(region,view);
                        this.childViewInstances.push(view);
                    }
                    else
                        throw new Error('view is not a constructor/function.')
                }
                else
                    console.warn(region+' :No such region exists.');
            },this);
        }
    }

//Header.View.js

, initialize: function()
{
this.model = new MovieGenres();
this.model.fetch();
this.model.on('change',this.render,this);
}`

here is the code. The header view which calls a model for data, and get intialized thrice with 2 more xhr call to backend.
dimtabu
@taburetkin
@sohankd i've take a look on your marionette.view.js

in first, i not recommend to monkey patch vendors prototypes
in case of backbone and marionette you can extend base classes with provided extend util
ex

const BaseView = Mn.View.extend({
  /* ... overrides and new methods */
})

then in your application you can use BaseView instead of Mn.View.

dimtabu
@taburetkin

the second thing is i found out dangerous thing in your code.
at least it looks like you not almost understand how prototypes and objects works in js

_.extend(Marionette.View.prototype,{
  childViewInstances: [], // this array instance will be shared between all Mn View instances, just because.
  // ...
}

and i find out that you just push something in that array in some method.
so, i believe this will lead you to some unexpected thing.

dimtabu
@taburetkin

there is a initialize method for setup the instance after initialization.
and your childViewInstances should not be a singleton.
so, you should initialize it something like this

Mn.View.extend({
   initialize() {
      this.childViewInstances = [];
   }
});

or

Mn.View.extend({
   constructor() {
      this.childViewInstances = []; // not good, but possible.
      Mn.View.apply(this, arguments);
      this.childViewInstances = []; // good.
   }
});

or even better you can make this property lazy, something like this:

Mn.View.extend({
   getChildViewInstances() {
      this._ensureChildViewInstances();
      return this.childViewInstances;
   },
   addChildViewInstance(view) {
     this._ensureChildViewInstances();
     this.childViewInstances.push(view);
   },
   _ensureChildViewInstances() {
     if (this.childViewInstances) return;
     this.childViewInstances = [];
   },
});

at this point i am thinking that your issues are because of childViewInstances is a singleton.
try to fix that in first.

Sohan Kumar
@sohankd
@taburetkin yes i am a beginner in this thing and thanks for correcting my faults. But i still have one doubt. You have overridden the initialize() of Mn.View. don't you think,if by mistake,in future, i again override this initialize() to fulfill my requirements, then the overridden intialize() of Mn.View will be overriden again?
dimtabu
@taburetkin
@sohankd sure you have to know what re you doing. i just illustrate that there are a lot of ways how it can be done
Sohan Kumar
@sohankd
@taburetkin okay. I don't know whether you have seen it or not, in marionette.view i have wrapped the render function of prototype object with my custom code. Is that too wrong ? Actually i
  • want to automate the initialization and rendering of child views of a view. That's i extnded the prototype object of marionette view,but i didn't know that it will lead me to this type situations.
dimtabu
@taburetkin
const SomeView = Mn.View.extend({
  myArray: [],  
});

const test1 = new SomeView();
test1.myArray.push(1);

const test2 = new SomeView();
test2.myArray.push(2);

console.log(test1.myArray == test2.myArray);
console.log(test1.myArray);
console.log(test2.myArray);
i am talking about such case. you are doing something similar with childViewInstances prototype property.
If you can answer what exactly will be in the console output then ok.
Sohan Kumar
@sohankd
I am not sure 100% . 1. true 2. [1] 3. [
[2]
Sohan Kumar
@sohankd
Thank you sir. I understood what you were trying to say.
dimtabu
@taburetkin
triggers: {
  click: 'click'
},
onClick(event) { ... }
triggers hash behind the scene uses trigger or triggerMethod ?
in other words will there call to onClick in the code above on dom click?
Paul Falgout
@paulfalgout
yep though I think it's onClick(thisView, event)
dimtabu
@taburetkin
ah, view will be first
ok, thx
guiop moip
@moilpguiop_gitlab
Good evening, please I would like to know that the OPTIONS properties is shared between the objects, because I have a BEHAVIOR which is used by several VIEW and as soon as a VIEW changes a property of the BEHAVIOR OPTIONS, this ownership changes in all other BEHAVIOR.
Alex Pounds
@creature
Hello! My Marionette app is very old, on v2.4. It makes extensive use of Marionette.module to split things into chunks. I know this is deprecated, and there's a shim; is there a recommended migration path here? For instance, a way I can declare each module as a more modern module pattern, without having to change hundreds of files at once?
Paul Falgout
@paulfalgout
@creature I assume you're using something to concatenate all of your source together? The first step I think is to introduce a build tool that will allow you to import dependencies and then slowly convert dependencies at the edges of your tree where it'd be like:
import Backbone from 'backbone';

Marionette.Module(...
Alex Pounds
@creature
@paulfalgout Yep, we're using the Rails asset pipeline right now. We haven't switched over to involving Webpacker yet (the default in Rails 6), so I don't know how that impacts this, if at all. My goal here is partially "get us off the deprecated system to ease a migration to an up-to-date version of Marionette", and partially "Make it easier to write unit tests for each little component in our system." Presumably by having each module declare its dependencies itself, rather than relying on being concatenated in the right order.
André Furquim
@mcand
Hi people. Has anyone managed to use incremental dom on a Mn application ? I'm trying to use this solution (https://github.com/google/incremental-dom) in my project, but as I use underscore templates I'm having some issues since it expects a dom node instead. If you could provide some links or tips on how to get it done, it would be much valuable for me.
Luiz Américo
@blikblum
André Furquim
@mcand
I haven't found an example with underscore templates, only handlebars. I wonder if it's possible to use underscore templates instead. Thank you @blikblum.