1
+ let fs = require ( 'fs/promises' )
2
+ let path = require ( 'path' )
3
+
4
+ let { Plinth, imageUtilities } = require ( '.' )
5
+
6
+ async function main ( ) {
7
+ let plinth = new Plinth ( 'devkit' )
8
+
9
+ let erase = function ( well ) {
10
+ console . log ( 'erasing well' , well . id )
11
+ let buf = Buffer . alloc ( 4096 , ' ' . charCodeAt ( 0 ) )
12
+ buf [ 0 ] = '{' . charCodeAt ( 0 )
13
+ buf [ 1 ] = '}' . charCodeAt ( 0 )
14
+ well . _writeMemory ( buf )
15
+ console . log ( 'erased well' , well . id )
16
+ }
17
+
18
+ //erase(plinth.wells[0])
19
+ console . log ( plinth . wells [ 0 ] . getData ( ) )
20
+ plinth . wells [ 0 ] . storeData ( { hello : 'chukwudi' } )
21
+ console . log ( plinth . wells [ 0 ] . getData ( ) )
22
+ plinth . wells [ 0 ] . storeData ( { hello : 'chukwudi' , ohyeah : 'coolaid' } )
23
+ console . log ( plinth . wells [ 0 ] . getData ( ) )
24
+ }
25
+
26
+ main ( )
27
+
1
28
// let fs = require('fs/promises')
2
29
// let path = require('path')
3
30
4
- // let { Plinth, imageUtilities } = require('.')
31
+ // let { Plinth, imageUtilities } = require('./ ')
5
32
6
33
// async function main() {
7
34
// let plinth = new Plinth('prototype')
15
42
// }
16
43
17
44
// let getData = function(well) {
18
- // return async () => {
45
+ // return () => {
19
46
// let data = well.getData()
20
- // console.log('data for card in well', well.id, data)
47
+ // return data
21
48
// }
22
49
// }
23
50
24
- // plinth.wells.forEach((well, i) => {
25
- // well.onAButtonPress(getData(well))
26
- // well.onBButtonPress(getData(well))
27
- // well.onCButtonPress(getData(well))
28
- // })
29
- // }
30
-
31
- // main()
32
-
33
- let fs = require ( 'fs/promises' )
34
- let path = require ( 'path' )
35
-
36
- let { Plinth, imageUtilities } = require ( './' )
37
-
38
- async function main ( ) {
39
- let plinth = new Plinth ( 'prototype' )
40
-
41
-
42
- let displayRandomImage = function ( well ) {
43
- return async ( ) => {
44
- let image = await imageUtilities . randomImage ( )
45
- plinth . wells [ well ] . displayImage ( image )
46
- }
47
- }
48
-
49
- let getData = function ( well ) {
50
- return ( ) => {
51
- let data = well . getData ( )
52
- return data
53
- }
54
- }
55
-
56
- let erase = function ( well ) {
57
- console . log ( 'erasing well' , well . id )
58
- let buf = Buffer . alloc ( 4096 , ' ' . charCodeAt ( 0 ) )
59
- buf [ 0 ] = '{' . charCodeAt ( 0 )
60
- buf [ 1 ] = '}' . charCodeAt ( 0 )
61
- well . _writeMemory ( buf )
62
- console . log ( 'erased well' , well . id )
63
- }
51
+ // let erase = function(well) {
52
+ // console.log('erasing well', well.id)
53
+ // let buf = Buffer.alloc(4096, ' '.charCodeAt(0))
54
+ // buf[0] = '{'.charCodeAt(0)
55
+ // buf[1] = ' }'.charCodeAt(0)
56
+ // well._writeMemory(buf)
57
+ // console.log('erased well', well.id)
58
+ // }
64
59
65
- let logCallbackPress = function ( well , buttonId ) {
66
- return async ( ) => {
67
- console . log ( 'logging button press by callback: well' , well . id , buttonId )
68
- }
69
- }
60
+ // let logCallbackPress = function(well, buttonId) {
61
+ // return async () => {
62
+ // console.log('logging button press by callback: well', well.id, buttonId)
63
+ // }
64
+ // }
70
65
71
- let logEventPress = function ( well ) {
72
- return ( e ) => {
73
- console . log ( 'logging button press by event: well' , e . well , e . button )
74
- }
75
- }
66
+ // let logEventPress = function(well) {
67
+ // return (e) => {
68
+ // console.log('logging button press by event: well', e.well, e.button)
69
+ // }
70
+ // }
76
71
77
- let logEventChordedPress = function ( well ) {
78
- return ( e ) => {
79
- console . log ( 'logging chorded button press by event: well' , e . well , e . buttons )
80
- }
81
- }
72
+ // let logEventChordedPress = function(well) {
73
+ // return (e) => {
74
+ // console.log('logging chorded button press by event: well', e.well, e.buttons)
75
+ // }
76
+ // }
82
77
83
- plinth . wells . forEach ( ( well , i ) => {
84
- well . onAButtonPress ( logCallbackPress ( well , 'a' ) )
85
- well . onBButtonPress ( logCallbackPress ( well , 'b' ) )
86
- well . onCButtonPress ( logCallbackPress ( well , 'c' ) )
87
- well . on ( 'buttonPress' , logEventPress ( well ) )
88
- well . on ( 'chordedButtonPress' , logEventChordedPress ( well ) )
89
- } )
90
- }
78
+ // plinth.wells.forEach((well, i) => {
79
+ // well.onAButtonPress(logCallbackPress(well, 'a'))
80
+ // well.onBButtonPress(logCallbackPress(well, 'b'))
81
+ // well.onCButtonPress(logCallbackPress(well, 'c'))
82
+ // well.on('buttonPress', logEventPress(well))
83
+ // well.on('chordedButtonPress', logEventChordedPress(well))
84
+ // })
85
+ // }
91
86
92
- main ( )
87
+ // main()
0 commit comments