MCPcopy Create free account
hub / github.com/alienkitty/space.js / setData

Method setData

src/ui/DetailsButton.js:134–158  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

132 // Public methods
133
134 setData(data) {
135 if (!data) {
136 return;
137 }
138
139 if (!this.number) {
140 this.number = new Interface('.number');
141 this.number.css({
142 position: 'absolute',
143 left: 34,
144 top: 12
145 });
146 this.number.text(data.count);
147 this.add(this.number);
148 }
149
150 if (String(data.count) === this.number.text()) {
151 return;
152 }
153
154 this.number.tween({ y: -10, opacity: 0 }, 300, 'easeInSine', () => {
155 this.number.text(data.count);
156 this.number.css({ y: 10 }).tween({ y: 0, opacity: 1 }, 1000, 'easeOutCubic');
157 });
158 }
159
160 resize() {
161 const dpr = 2; // Always 2

Callers

nothing calls this directly

Calls 4

cssMethod · 0.80
textMethod · 0.80
addMethod · 0.45
tweenMethod · 0.45

Tested by

no test coverage detected