Skip to content

[pkg:html_imports] Rename @polymerInitMethod #12389

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

Closed
sethladd opened this issue Aug 12, 2013 · 7 comments
Closed

[pkg:html_imports] Rename @polymerInitMethod #12389

sethladd opened this issue Aug 12, 2013 · 7 comments
Labels
type-enhancement A request for a change that isn't a bug
Milestone

Comments

@sethladd
Copy link
Contributor

Rename @­polymerInitMethod. This is not a Polymer feature, it's a polyfill for Dartium so it can support multiple <script> tags. Perhaps @­mainMethod? And allow you to omit the attribute if your method is called "main" or "_main"?

also, this feature should work regardless of whether the <script> is in a <polymer-element> or not. I'm not sure if that's the case already.

@sigmundch
Copy link
Member

Some notes:
a) We unfortunately can't call it "_main" because dart2js doesn't like using private symbols, that is, symbols starting with _ (I tried, this was my favorite option)

b) Currently the feature doesn't work outside of polymer-element tags. There are several questions here we need to figure out. For example what's the meaning of more than 1 script tag on the page.

Currently Dartium says that each script tag run in its own isolate. Currently boot.js tries to preserve this for top-level tags: we take all the script tags from polymer-elements (A) and all the top-level script tags (B). For each tag S in (B), we create a new script tag that invokes S.main and each init method in A. That means that we continue to have an isolate for each top-level script tag that was originally in the code.


cc @vsmenon.
cc @blois.

@jmesserly
Copy link

yeah, we need some way to avoid one-script-per-isolate if we want to use Polymer/custom elements style of programming. Being able to execute <script> tags against the same DOM and heap is pretty important.

(To be honest, I don't understand the use case for so-called "DOM isolates". They're sharing the DOM but pretending the scripts are isolated. Custom Elements and MDV both place Dart objects in the DOM, so it makes even less sense now.

If we load all <script> tags into the same Dart isolate, Dart already gives pretty nice encapsulation of top level names and a good import system. If your app wants more isolation than that, an iframe will give actual DOM protection.)


Changed the title to: "[pkg:html_imports] Rename @polymerInitMethod".

@jmesserly
Copy link

@Sigmund -- we don't need to be blocked on the Dartium issues right? Boot.js can do whatever it needs to do (it already does :) )

@sigmundch
Copy link
Member

Totally. I'd just like to have a design that will match the same semantics of the Dartium of the future =).

@sigmundch
Copy link
Member

Marked this as blocking #12405.

@sigmundch
Copy link
Member

Added this to the M8 milestone.

@jmesserly
Copy link

this is now @­initMethod


Added Fixed label.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants