const routeBack = ( global, unselectNote ) => ( event ) => { event.stopPropagation(); event.preventDefault(); global.input.lastInputWasKeyboard = false; unselectNote(); }
query(query, values) { let cancelFn = null; const promise = this.initialConnectPromise.then((pool) => { const request = pool.request(); (values || []).forEach((v, i) => request.input(`_${i + 1}`, v)); // TODO time zone UTC set in driver ? cancelFn = () => request.cancel(); return request.query(query).then(res => res.recordset); }); promise.cancel = () => cancelFn && cancelFn(); return promise; }
hint() { if (!this.state.submitted) { return this.styles.muted(`(${dollars(this.input, this.options.price)})`); } }
function inputYXOffset(mode) { const gpu = new GPU({ mode }); const kernel = gpu.createKernel(function(a) { return a[this.thread.x][this.thread.y]; }) .setOutput([8, 2]); const a = new Float32Array(16); a.set([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]); const result = kernel(input(a, [2, 8])); assert.deepEqual(result.map(function(v) { return Array.from(v); }), [[1,3,5,7,9,11,13,15],[2,4,6,8,10,12,14,16]]); gpu.destroy(); }
onKeyEnter(cm) { let activeSuggestion = ReplActiveInputStore.getStore().activeSuggestion; if(activeSuggestion && global.Mancy.preferences.autoCompleteOnEnter) { let {suggestion} = activeSuggestion; this.onSelectTabCompletion(suggestion.input, suggestion.expect); return; } return !global.Mancy.preferences.toggleShiftEnter ? this.onRun() : CodeMirror.Pass; }
save() { if (!this.store) return; this.data = completer('save', this.data, this.input); this.store.set('values', this.data); }
toVector(item) { return { input: this.inputLookup.toVector(item.input), output: this.outputLookup.toVector(item.output), }; }
repl.input.on('data', (d) => { if(d === EOL) { nodeLineListener(promptData); promptData = ''; } });
up(number) { let step = number || this.minor; let num = this.toNumber(this.input); if (num > this.max + step) return this.alert(); this.input = `${num + step}`; return this.render(); }
right() { if (this.cursor >= this.input.length) return this.alert(); this.moveCursor(1); this.render(); }
down(number) { let step = number || this.minor; let num = this.toNumber(this.input); if (num < this.min - step) return this.alert(); this.input = `${num - step}`; return this.render(); }
right() { if (this.cursor >= this.input.length) return this.alert(); this.cursor++; return this.render(); }