Code Monkey home page Code Monkey logo

Comments (6)

yasinuslu avatar yasinuslu commented on August 15, 2024

loadingTemplate and notFoundTemplate wasn't working. After 2 hours of debugging i found out that when i define initialize method i have overriden RouteController's initialize method and router couldn't pass options to controller. Now i'm using onBeforeRun instead of initialize. Everything works fine.

I think when we define initialize method while extending a class instead of overriding parent's initialize both parent's and child's initialize methods should run just like Java.

I think this might help you clean up more code and could automatically solve this issue (#35).

from iron-router.

cmather avatar cmather commented on August 15, 2024

Agreed on the initialize method. That was a quick last minute change to give server/client routers a chance to deal differently with initialization, but that logic should be in an overridden constructor. The current behavior is counter intuitive, and people probably won't remember to call the super method.

from iron-router.

yasinuslu avatar yasinuslu commented on August 15, 2024

I'm sure you've got some design in your mind before starting to implement Posture

I want to share 3 ideas that might improve the design:

1-) using something like http://underscorejs.org/#after (though it might open parent's scope to child)
2-) executing super before extending fields
3-) some hook like onAfterInit to call after super

I can always take some of the work if you don't have time.

from iron-router.

cmather avatar cmather commented on August 15, 2024

Hey @yasinuslu, Are you talking about the private Posture package? Or the inheritance mechanism with RouteController?

from iron-router.

yasinuslu avatar yasinuslu commented on August 15, 2024

Sorry @cmather i didn't have time lately. I thought Posture was the package providing OOP features for RouteController when i wrote my comment :) Yes i'm talking about inheritance mechanism.

from iron-router.

cmather avatar cmather commented on August 15, 2024

All of this should be cleaned up quite a bit in dev. I'm just using the regular constructor now and calling super methods using the Class.super. You can look at lib/client/route_controller as an example.

from iron-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.