Have boot create Polymer() fn, and polymer-fn install _polymerFn callback.

This commit is contained in:
Kevin Schaaf
2017-02-15 17:11:06 -08:00
parent f51fb4d980
commit 6ef8b32cb5
3 changed files with 11 additions and 18 deletions

View File

@@ -1,6 +1,5 @@
<link rel="import" href="src/legacy/legacy-element-mixin.html">
<link rel="import" href="src/legacy/polymer-fn.html">
<link rel="import" href="src/legacy/class.html">
<!-- template elements -->
<link rel="import" href="src/legacy/templatizer-behavior.html">
<link rel="import" href="src/elements/dom-bind.html">

View File

@@ -7,20 +7,14 @@ The complete set of contributors may be found at http://polymer.github.io/CONTRI
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="class.html">
<script>
(function() {
// TODO(sorvell): There is an implicit depency on `Polymer.Class` here
// that would be good to resolve. It's because (elements/class.html)
// because this file specially handles `Polymer`.
// Polymer is a Function, but of course this is also an Object, so we
// hang various other objects off of Polymer.*
var userPolymer = window['Polymer'];
window['Polymer'] = function(info) {
window.Polymer._polymerFn = function(info) {
// if input is a `class` (aka a function with a prototype), use the prototype
// remember that the `constructor` will never be called
var klass;
@@ -37,12 +31,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return klass;
};
if (userPolymer) {
for (var i in userPolymer) {
Polymer[i] = userPolymer[i];
}
}
})();
</script>

View File

@@ -9,7 +9,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
-->
<script>
window.Polymer = window.Polymer || {};
window.Polymer = function(info) {
return window.Polymer._polymerFn(info);
}
// To be plugged by legacy implementation if loaded
window.Polymer._polymerFn = function() {
throw new Error('Load polymer.html to use the Polymer() function.');
}
window.Polymer.version = '2.0-preview';
/* eslint-disable no-unused-vars */