-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] How to populate the div within a Surface using Javascript #59
Comments
A
I'm open to suggestions here if you think there's a better/easier way of doing things. |
Also, when you first create the surface you can do something like
|
Thank you for your quick response! Oops, I just noticed I submitted my question incomplete, even mid-sentence... its very late here, I'm sleepy... - fixed now The solutions you described ( the other options for 'content', on('deploy') event, and _currentTarget) should work just fine for my needs. I imagine it will be useful for other developers as well - I suggest to add documentations about it, and maybe make a new example with surfaces that contain some rich UI widgets (eg. datetime picker, RGB picker, etc...). For a more robust integration I suggest defining a lifecycle of Surface insert/rerender/removal - with events or methods that can be overridden - A thought about re-rendering and animations - since the inner widget rendering may be very slow, re-rendering the content while (for example) a size changes can lead to crappy resize animation - maybe just re-render when the animation completes. |
To your last point, I think we can do something to defer the Currently there are two life-cycle events that surfaces listen to: |
Hmm, I agree "after deploy" is much more useful than "before deploy" - So I agree no real need to add the less useful events. I can imagine use case where the "before deploy" can be useful - especially if the framework waits for the "before deploy" to complete asynchronously (eg. by having the "before" method to return a promise and continuing the deploy after the promise succeeds) For example suppose you want to load data (eg. from AJAX, IndexedDB, etc..) just prior to showing a Surface, wherever it is located, however it is added. |
I would be very hesitant to introduce any type of "exotic" event triggers such as If you need to load a library, either load the library at bootstrap or use the So I'm definitely 👎 for expanding the current |
I'm fine with leaving the current deploy and recall events, I wouldn't have raised this question if I had known about them and I only suggested the extra events as quick suggestion off the top of my head. But -
|
Good points all around. It should be known that For now I'd like to keep the life-cycle surface area to a minimum, and we'll see if there are any issues raised as a result. In which case I'm happy to add more hooks into the system. |
Say I want to insert a CodeMirror IDE inside a surface, or a JQuery UI (eg. jsTree), or an Ember component, etc...
There doesn't seem to be a documented way to insert content into a Surface except for the content string, which is VERY limiting.
Something along getting the DOM element of the Surface and modifying it when the Surface is initialized is a not a very holistic solution but its good enough for many useful use cases.
The text was updated successfully, but these errors were encountered: