2023-05-09 13:25:39 +02:00
|
|
|
<!DOCTYPE html>
|
2019-03-21 09:57:27 +01:00
|
|
|
<html lang="en">
|
2023-05-09 13:25:39 +02:00
|
|
|
<head>
|
|
|
|
<title>Poppable Doctest</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<link rel="stylesheet" href="./3rdparty/highlight/styles/default.css" />
|
|
|
|
<link rel="stylesheet" href="../css/doctest.css" />
|
|
|
|
<script src="./3rdparty/highlight/highlight.pack.js"></script>
|
|
|
|
<script src="./3rdparty/all.js"></script>
|
|
|
|
<script src="../dist/iwmlib.js"></script>
|
|
|
|
</head>
|
2019-03-21 09:57:27 +01:00
|
|
|
|
2023-05-09 13:25:39 +02:00
|
|
|
<body id="page" onload="Doctest.run()">
|
|
|
|
<h1><a href="index.html">lib.</a>Poppables</h1>
|
|
|
|
<p>
|
|
|
|
Poppables present information on demand in a given context. This is an abstract base class for Popup menus
|
|
|
|
and other contextual information like image highlights. It's main purpose is to ensure that only one
|
|
|
|
poppable at a time can be shown in a given context. Note that in an application multiple poppables can be
|
|
|
|
shown in different context at the same time.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Let's look at an example of a popup class. In this class the register method is called by the constructor.
|
|
|
|
The class also implements a close method which is called if the second poppable is registered.
|
|
|
|
<script class="doctest">
|
|
|
|
class ConcretePoppable extends Poppable {
|
|
|
|
constructor(context) {
|
|
|
|
super()
|
|
|
|
this.register(context)
|
|
|
|
}
|
2019-03-21 09:57:27 +01:00
|
|
|
|
2023-05-09 13:25:39 +02:00
|
|
|
close() {
|
|
|
|
alert('closed')
|
|
|
|
}
|
|
|
|
}
|
2019-03-21 09:57:27 +01:00
|
|
|
|
2023-05-09 13:25:39 +02:00
|
|
|
let context = window
|
|
|
|
let a = new ConcretePoppable(context)
|
|
|
|
let b = new ConcretePoppable(context)
|
|
|
|
</script>
|
|
|
|
</p>
|
|
|
|
</body>
|
|
|
|
</html>
|