forked from google/jsaction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnullactionflow.js
57 lines (47 loc) · 1.68 KB
/
nullactionflow.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
// Copyright 2012 Google Inc. All rights reserved.
/**
* @fileoverview Defines a "Null" ActionFlow object, which can be passed to
* ActionFlow-requiring functions in lieu of an actual ActionFlow object.
* Intended to be used by projects that are in the process of adopting
* ActionFlow for latency tracking, or just need to use ActionFlow-requiring
* code. Any attempt to branch or done a NullActionFlow will cause an assertion
* failure - if your usage of NullActionFlow results in such an assertion
* failure, you should switch to using an actual ActionFlow object instead.
*
* @author [email protected] (Izaak Rubin)
*/
goog.provide('jsaction.NullActionFlow');
goog.require('goog.asserts');
goog.require('jsaction.ActionFlow');
/**
* Creates a NullActionFlow.
* @constructor
* @extends {jsaction.ActionFlow}
*/
jsaction.NullActionFlow = function() {
jsaction.NullActionFlow.base(this, 'constructor',
jsaction.NullActionFlow.FLOW_TYPE_);
};
goog.inherits(jsaction.NullActionFlow, jsaction.ActionFlow);
/**
* A default flow type to use for NullActionFlows.
* @const {string}
* @private
*/
jsaction.NullActionFlow.FLOW_TYPE_ = 'NULL_FLOW';
/**
* Raises an assertion failure if called.
* @override
*/
jsaction.NullActionFlow.prototype.branch = function(branch) {
goog.asserts.fail('Attempted to branch a NullActionFlow - use a ActionFlow ' +
'instead to avoid this assertion failure.');
};
/**
* Raises an assertion failure if called.
* @override
*/
jsaction.NullActionFlow.prototype.done = function(branch) {
goog.asserts.fail('Attempted to done a NullActionFlow - use a ActionFlow ' +
'instead to avoid this assertion failure.');
};