@peter.naydenov/cuts 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.html +15 -0
- package/package.json +1 -1
- package/src/methods/show.js +5 -4
package/index.html
CHANGED
|
@@ -9,5 +9,20 @@
|
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="app"></div>
|
|
12
|
+
<script type="module">
|
|
13
|
+
import cuts from './src/main.js'
|
|
14
|
+
let app = cuts ()
|
|
15
|
+
|
|
16
|
+
let testScene = {
|
|
17
|
+
name: 'testScene'
|
|
18
|
+
, scene : {
|
|
19
|
+
show: () => { console.log('show') }
|
|
20
|
+
, hide: () => { console.log ('hide') }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
console.log ( app )
|
|
24
|
+
app.setScenes ( [ testScene] )
|
|
25
|
+
app.show ( 'testScene' )
|
|
26
|
+
</script>
|
|
12
27
|
</body>
|
|
13
28
|
</html>
|
package/package.json
CHANGED
package/src/methods/show.js
CHANGED
|
@@ -27,18 +27,18 @@ function show ( dependencies, state ) {
|
|
|
27
27
|
closingFn ({ done:unloadTask.done, dependencies })
|
|
28
28
|
}
|
|
29
29
|
} // if currentPage
|
|
30
|
-
else unloadTask.done ()
|
|
30
|
+
else unloadTask.done ( true )
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
unloadTask.onComplete ( continueLoading => {
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
if ( !continueLoading ) {
|
|
36
36
|
// if the 'beforeUnload' function returns false
|
|
37
37
|
// Cancel loading the new scene
|
|
38
38
|
showTask.done ()
|
|
39
39
|
return showTask.promise
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
if ( !sceneNames.has ( requestedScene ) ) {
|
|
43
43
|
if ( log ) {
|
|
44
44
|
log ({
|
|
@@ -50,7 +50,7 @@ function show ( dependencies, state ) {
|
|
|
50
50
|
return showTask.promise
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
if ( !opened && options.ssr ) { // Check for Server side rendering on first scene load only
|
|
55
55
|
// Executes only once when the scene manager is started
|
|
56
56
|
state.opened = true
|
|
@@ -109,6 +109,7 @@ function show ( dependencies, state ) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
const goingTask = askForPromise.sequence ( instructions ); // Execute open steps(show and hide) in sequence
|
|
112
|
+
|
|
112
113
|
goingTask.onComplete ( () => {
|
|
113
114
|
state.opened = true
|
|
114
115
|
shortcutMngr.changeContext ( requestedScene )
|