teamplay 0.4.0-alpha.2 → 0.4.0-alpha.3

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.
@@ -228,20 +228,23 @@ await $$agg.subscribe()
228
228
  const rows = $$agg.getExtra()
229
229
  ```
230
230
 
231
- ### get()
231
+ ### get(subpath?)
232
232
 
233
233
  Returns the current value and tracks reactivity.
234
234
 
235
235
  ```js
236
236
  const name = $.users.user1.name.get()
237
+ $root.get('$render.url')
238
+ $user.get('profile.name')
237
239
  ```
238
240
 
239
- ### peek()
241
+ ### peek(subpath?)
240
242
 
241
243
  Returns the current value **without** tracking reactivity.
242
244
 
243
245
  ```js
244
246
  const name = $.users.user1.name.peek()
247
+ $user.peek('profile.name')
245
248
  ```
246
249
 
247
250
  ### getCopy(subpath)
@@ -118,12 +118,26 @@ class SignalCompat extends Signal {
118
118
  }
119
119
 
120
120
  get () {
121
+ if (arguments.length > 1) throw Error('Signal.get() expects zero or one argument')
122
+ if (arguments.length === 1) {
123
+ const segments = parseAtSubpath(arguments[0], 1, 'Signal.get()')
124
+ const $base = resolveRefSignal(this)
125
+ const $target = resolveSignal($base, segments)
126
+ return Signal.prototype.get.call($target)
127
+ }
121
128
  const $target = resolveRefSignal(this)
122
129
  if ($target !== this) return Signal.prototype.get.apply($target, arguments)
123
130
  return Signal.prototype.get.apply(this, arguments)
124
131
  }
125
132
 
126
133
  peek () {
134
+ if (arguments.length > 1) throw Error('Signal.peek() expects zero or one argument')
135
+ if (arguments.length === 1) {
136
+ const segments = parseAtSubpath(arguments[0], 1, 'Signal.peek()')
137
+ const $base = resolveRefSignal(this)
138
+ const $target = resolveSignal($base, segments)
139
+ return Signal.prototype.peek.call($target)
140
+ }
127
141
  const $target = resolveRefSignal(this)
128
142
  if ($target !== this) return Signal.prototype.peek.apply($target, arguments)
129
143
  return Signal.prototype.peek.apply(this, arguments)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teamplay",
3
- "version": "0.4.0-alpha.2",
3
+ "version": "0.4.0-alpha.3",
4
4
  "description": "Full-stack signals ORM with multiplayer",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -81,5 +81,5 @@
81
81
  ]
82
82
  },
83
83
  "license": "MIT",
84
- "gitHead": "ad790a31ac628c9ea5ac851572533620ac0b7602"
84
+ "gitHead": "01e91057b9146cc1f653f8c35054dba33ca52802"
85
85
  }