forked from ampproject/amphtml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon-signals.js
75 lines (68 loc) · 2.29 KB
/
common-signals.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* Copyright 2017 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Commonly used signals across different elements and documents.
* @enum {string}
*/
export const CommonSignals = {
/**
* The element has been upgraded from ElementStub to its real implementation.
*/
UPGRADED: 'upgraded',
/**
* The element has been built.
*/
BUILT: 'built',
/**
* The element has started loading.
* LOAD_START triggers at the start of the layoutCallback.
*/
LOAD_START: 'load-start',
/**
* Rendering has been confirmed to have been started.
* It is a signal to indicate meaningful display (e.g. text could be displayed
* CSS is correctly installed/applied).
*
* Elements can optionally implement RENDER_START signal. (e.g. ad, shadowdoc)
* if it want to define its own meaningful display time and toggle visibility.
*
* Simpler elements's RENDER_START can be equal to the start of the
* buildCallback
*/
RENDER_START: 'render-start',
/**
* The element has been loaded.
* LOAD_END triggers at the end of the layoutCallback.
*
*/
LOAD_END: 'load-end',
/**
* The initial contents of an element/document/embed have been loaded.
* INI_LOAD is an optional signal, implemented by ads, story, and elements
* that consist of other resources.
* It instructs that all critical resources has been loaded, and can be used
* for more accurate visibility measurement.
* When an element doesn't consist multiple child resources, LOAD_END signal
* can be used to indicate resource load completion.
* Note: Based on the implementation, INI_LOAD can trigger before or after
* LOAD_END.
*/
INI_LOAD: 'ini-load',
/**
* The element has been unlaid out.
*/
UNLOAD: 'unload',
};