-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCoffeeBean.js.html
83 lines (69 loc) · 3.14 KB
/
CoffeeBean.js.html
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
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>webdoc: Source: CoffeeBean.js</title>
<script src="scripts/prettify.js"> </script>
<script src="scripts/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/tomorrow.min.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
<link type="text/css" rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.3/styles/googlecode.min.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: CoffeeBean.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* This class illustrates how you can create a Java-bean like component in JavaScript
*
* @extends Bean
*/
export class CoffeeBean {
/**
* @param {object}[options]
* @param {boolean}[options.roasted] - whether the bean is `roasted`
* @param {number}[options.maturity]
*/
constructor(options = {}) {
/** @type {boolean} */
this.roasted = typeof options.roasted === "boolean" ? options.roasted : false;
/**
* @name maturity
* @type {number}
*/
this._maturity = typeof options.maturity === "number" ? options.maturity : 1;
}
/**
* Roast this coffee bean.
*
* NOTE: You cannot re-roast coffee beans and an error will be thrown if you try to
* roast a roasted coffee bean.
*
* @throws Error
*/
roast() {
if (this.roasted) {
throw new Error("Cannot roasted a roasted coffee bean");
}
this.roasted = true;
}
}
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Tutorials</h3><ul><li><a href="car.html">car</a></li><li><a href="road.html">road</a></li></ul><h3>Namespaces</h3><ul><li><a href="PIXI.html">PIXI</a></li><li><a href="PIXI.utils.html">utils</a></li><li><a href="R.html">R</a></li><li><a href="Ts.html">Ts</a></li></ul><h3>Classes</h3><ul><li><a href="Bean.html">Bean</a></li><li><a href="Car_.html">Car</a></li><li><a href="CoffeeBean.html">CoffeeBean</a></li><li><a href="Gravity.html">Gravity</a></li><li><a href="PhysicalInteraction.html">PhysicalInteraction</a></li><li><a href="PhysicalObject.html">PhysicalObject</a></li><li><a href="PIXI.AbstractBatchRenderer.html">AbstractBatchRenderer</a></li><li><a href="PIXI.AbstractRenderer.html">AbstractRenderer</a></li><li><a href="PIXI.ObjectRenderer.html">ObjectRenderer</a></li><li><a href="PIXI.System.html">System</a></li><li><a href="PIXI.TilingSprite.html">TilingSprite</a></li><li><a href="R.Road.html">Road</a></li><li><a href="Ts.Transaction.html">Transaction</a></li><li><a href="Vector.html">Vector</a></li></ul><h3>Interfaces</h3><ul><li><a href="CarDealer.html">CarDealer</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/webdoc-js/webdoc">webdoc 1</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>