File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
snaps-sdk/src/types/handlers Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -50,3 +50,29 @@ export type OnUpdateHandler = LifecycleEventHandler;
5050 * @param args.origin - The origin that triggered the lifecycle event hook.
5151 */
5252export type OnStartHandler = LifecycleEventHandler ;
53+
54+ /**
55+ * The `onActive` handler. This is called when the Snap becomes active.
56+ *
57+ * Note that using this handler requires the `endowment:lifecycle-hooks`
58+ * permission.
59+ *
60+ * This type is an alias for {@link LifecycleEventHandler}.
61+ *
62+ * @param args - The request arguments.
63+ * @param args.origin - The origin that triggered the lifecycle event hook.
64+ */
65+ export type OnActiveHandler = LifecycleEventHandler ;
66+
67+ /**
68+ * The `onInactive` handler. This is called when the Snap becomes inactive.
69+ *
70+ * Note that using this handler requires the `endowment:lifecycle-hooks`
71+ * permission.
72+ *
73+ * This type is an alias for {@link LifecycleEventHandler}.
74+ *
75+ * @param args - The request arguments.
76+ * @param args.origin - The origin that triggered the lifecycle event hook.
77+ */
78+ export type OnInactiveHandler = LifecycleEventHandler ;
Original file line number Diff line number Diff line change 11import type {
2+ OnActiveHandler ,
23 OnAssetHistoricalPriceHandler ,
34 OnAssetsConversionHandler ,
45 OnAssetsLookupHandler ,
56 OnAssetsMarketDataHandler ,
67 OnClientRequestHandler ,
78 OnCronjobHandler ,
89 OnHomePageHandler ,
10+ OnInactiveHandler ,
911 OnInstallHandler ,
1012 OnKeyringRequestHandler ,
1113 OnNameLookupHandler ,
@@ -75,14 +77,14 @@ export const SNAP_EXPORTS = {
7577 [ HandlerType . OnActive ] : {
7678 type : HandlerType . OnActive ,
7779 required : false ,
78- validator : ( snapExport : unknown ) : snapExport is OnStartHandler => {
80+ validator : ( snapExport : unknown ) : snapExport is OnActiveHandler => {
7981 return typeof snapExport === 'function' ;
8082 } ,
8183 } ,
8284 [ HandlerType . OnInactive ] : {
8385 type : HandlerType . OnInactive ,
8486 required : false ,
85- validator : ( snapExport : unknown ) : snapExport is OnStartHandler => {
87+ validator : ( snapExport : unknown ) : snapExport is OnInactiveHandler => {
8688 return typeof snapExport === 'function' ;
8789 } ,
8890 } ,
You can’t perform that action at this time.
0 commit comments