blob: 8606546f017b8c975a94c300019ca7a840439bd6 (
plain)
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
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { BaseStudyAction } = ChromeUtils.import(
"resource://normandy/actions/BaseStudyAction.jsm"
);
const lazy = {};
ChromeUtils.defineModuleGetter(
lazy,
"ExperimentManager",
"resource://nimbus/lib/ExperimentManager.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"ActionSchemas",
"resource://normandy/actions/schemas/index.js"
);
const EXPORTED_SYMBOLS = ["MessagingExperimentAction"];
const RECIPE_SOURCE = "normandy";
class MessagingExperimentAction extends BaseStudyAction {
constructor() {
super();
this.manager = lazy.ExperimentManager;
}
get schema() {
return lazy.ActionSchemas["messaging-experiment"];
}
async _run(recipe) {
if (recipe.arguments) {
await this.manager.onRecipe(recipe.arguments, RECIPE_SOURCE);
}
}
async _finalize() {
this.manager.onFinalize(RECIPE_SOURCE);
}
}
|