Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rename 'rootEl' param on application to 'region' #2770

Closed
RobertCZ opened this issue Sep 25, 2015 · 5 comments
Closed

Rename 'rootEl' param on application to 'region' #2770

RobertCZ opened this issue Sep 25, 2015 · 5 comments

Comments

@RobertCZ
Copy link

RootEl indicates, well, element. Why not call it just 'region'? Name 'rootEl' doesnt work very well when you want to pass previously created region. With 'region' name, it can still be initialized as el, selector or region, but will give us a much nicer pattern for child apps - basically every app could have a region to use passed from outside (eg parent app or main):

// main with default region
let rootApp = new RootApp()
// equivalent to 
let rootApp = new RootApp({region: document.body})


// RootApp#ctor
this.view = new View()
this.region.show(this.view)

// RootApp#startChildApp
let region = this.view.getRegion('child')
let childApp = new ChildApp({region})
childApp.start()

Also, regions' show (and maybe also getRegion) can be aliased directly on app (from this.region and this.region.currentView resp.)

this.show(new View())
let region = this.getRegion('child')
(new ChildApp({region})).start()
@blikblum
Copy link
Collaborator

Why not rootRegion?

@RobertCZ
Copy link
Author

Backbone view receives model, option is called model and is available in view as this.model. Marionette region has option el with the same conventions. This application.region looks quite similar.

@jasonLaster
Copy link
Member

Thanks @RobertCZ - feel free to comment directly on the PR #2763

@RobertCZ
Copy link
Author

I did but I wasn't sure it was the right place. Shall I close this one and we continue in PR?

@paulfalgout
Copy link
Member

Closing for continuation on PR

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants