mathjs; downgrade version & deprecate syntax
This commit is contained in:
parent
5ff01fd845
commit
3e93ef8dc4
4 changed files with 22 additions and 11 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
## 0.49.0
|
||||
|
||||
- **deprecation** MathJS syntax is deprecated and will be removed in the future in favor of the Javascript syntax
|
||||
- bug fixes:
|
||||
- widgets: missing `target` property for `plots/*` widgets, required for MIDI bindings
|
||||
- editor: set `label` to `auto` instead of `true` when using the toggle button
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
"keyboardjs": "github:jean-emmanuel/KeyboardJS",
|
||||
"licensify": "3.1.3",
|
||||
"loop-protect": "github:jean-emmanuel/loop-protect#v1.0.1",
|
||||
"mathjs": "6.5.0",
|
||||
"mathjs": "5.10.0",
|
||||
"minimatch": "3.0.4",
|
||||
"nanohtml": "1.9.0",
|
||||
"nanoid": "2.1.10",
|
||||
|
|
|
|||
|
|
@ -70,9 +70,21 @@ By default, osc listeners inherit the widget's `preArgs` and (these must be matc
|
|||
OSC{color, "auto", false}
|
||||
```
|
||||
|
||||
## Javascript: `JS{{}}`
|
||||
|
||||
This syntax allows writing formulas in pure javascript. The code will be compiled as a function and executed a restricted context.
|
||||
|
||||
- if no `return` statement is found, the formula will return an empty string
|
||||
- javascript [strict mode](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Strict_mode) is always enabled
|
||||
- `setTimeout` and `setInterval` functions are not available
|
||||
- the `global` object is shared between all javascript formulas (changing its properties *does not* trigger any synchronisation even if the value is used somewhere else)
|
||||
|
||||
|
||||
## Formulas: `#{}`
|
||||
|
||||
!!! warning "Deprecated"
|
||||
This syntax is deprecated and will be removed in the future. Use the javascript syntax instead.
|
||||
|
||||
The following syntax allow writing mathematical formulas in widgets' properties:
|
||||
|
||||
```
|
||||
|
|
@ -101,13 +113,3 @@ Additionnal functions:
|
|||
|
||||
!!! tip ""
|
||||
A single widget property can contain multiple formulas. Variables and functions declared in a formula are available to subsequent formulas in the same property definition.
|
||||
|
||||
|
||||
## Javascript: `JS{{}}`
|
||||
|
||||
This syntax allows writing formulas in pure javascript. The code will be compiled as a function and executed a restricted context.
|
||||
|
||||
- if no `return` statement is found, the formula will return an empty string
|
||||
- javascript [strict mode](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Strict_mode) is always enabled
|
||||
- `setTimeout` and `setInterval` functions are not available
|
||||
- the `global` object is shared between all javascript formulas (changing its properties *does not* trigger any synchronisation even if the value is used somewhere else)
|
||||
|
|
|
|||
|
|
@ -9,8 +9,11 @@ var EventEmitter = require('../../events/event-emitter'),
|
|||
OscReceiver = require('./osc-receiver'),
|
||||
{deepCopy, deepEqual} = require('../../utils'),
|
||||
html = require('nanohtml'),
|
||||
ipc = require('../../ipc'),
|
||||
updateWidget = ()=>{}
|
||||
|
||||
|
||||
var mathjsDeprecationWarned = false
|
||||
var oscReceiverState = {}
|
||||
|
||||
var OSCProps = [
|
||||
|
|
@ -583,6 +586,11 @@ class Widget extends EventEmitter {
|
|||
propValue = propValue.replace(/#\{(?:[^{}]|\{[^{}]*\})*\}/g, (m)=>{
|
||||
// one bracket nesting allowed, if we need two: #\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\}
|
||||
|
||||
if (!mathjsDeprecationWarned) {
|
||||
mathjsDeprecationWarned = true
|
||||
ipc.send('error', 'Warning: MathJS syntax (#{}) is deprecated and will be removed in the future. Consider using the Javascript syntax instead.')
|
||||
}
|
||||
|
||||
// unescape brackets (not needed anymore, just here for backward compatibility)
|
||||
m = m.replace(/\\(\{|\})/g, '$1')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue