-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lazy register features we can be deferred until first instance. This …
…is an optimization which can speed up page load time when elements are registered but not needed at time of first paint/interaction
- Loading branch information
Steven Orvell
committed
Mar 14, 2016
1 parent
edb59eb
commit 31702ff
Showing
7 changed files
with
147 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
|
||
<title>lazy-register</title> | ||
|
||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<script> | ||
Polymer = {lazyRegistration: true}; | ||
</script> | ||
<script src="../../../webcomponentsjs/webcomponents-lite.js"></script> | ||
<link rel="import" href="../../polymer.html"> | ||
|
||
</head> | ||
<body> | ||
|
||
<script> | ||
(function() { | ||
var lr = Polymer.Base._ensureRegistered; | ||
Polymer.Base._ensureRegistered = function(proto) { | ||
console.log('_ensureRegistered', proto.is); | ||
lr.call(this, proto); | ||
} | ||
|
||
})(); | ||
</script> | ||
|
||
<dom-module id="x-base"> | ||
<script> | ||
Polymer({ | ||
|
||
is: 'x-base', | ||
|
||
properties: { | ||
state: {value: 'live!'} | ||
} | ||
|
||
}); | ||
</script> | ||
</dom-module> | ||
|
||
<dom-module id="x-foo"> | ||
<template>I {{state}}</template> | ||
<script> | ||
XFoo = Polymer({ | ||
|
||
is: 'x-foo', | ||
extends: 'x-base' | ||
|
||
}); | ||
</script> | ||
</dom-module> | ||
|
||
<dom-module id="x-bar"> | ||
<script> | ||
Polymer({ | ||
|
||
is: 'x-bar', | ||
extends: 'x-foo' | ||
|
||
}); | ||
</script> | ||
</dom-module> | ||
|
||
|
||
<script> | ||
// console.log('XFoo has performed lazy registration tasks', Boolean(XFoo.prototype._template)); | ||
// console.log('Create XFoo', new XFoo()); | ||
// console.log('XFoo has performed lazy registration tasks', Boolean(XFoo.prototype._template)); | ||
</script> | ||
|
||
<!-- <x-bar></x-bar> --> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters