Changeset - bc8989d84bb2
[Not reviewed]
default
0 2 0
Drew Perttula - 6 years ago 2019-06-01 02:25:28
drewp@bigasterisk.com
2 files changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
light9/web/graph.coffee
Show inline comments
 
@@ -365,12 +365,13 @@ class window.SyncedGraph
 
      current = rests[0].object
 
    
 
    return out
 

	
 
  contains: (s, p, o) ->
 
    @_autoDeps.askedFor(s, p, o, null)
 
    log('contains calling getQuads when graph has ', 
 
    return @graph.getQuads(s, p, o).length > 0
 

	
 
  nextNumberedResources: (base, howMany) ->
 
    # base is NamedNode or string
 
    # Note this is unsafe before we're synced with the graph. It'll
 
    # always return 'name0'.
 
@@ -384,12 +385,13 @@ class window.SyncedGraph
 
      start = 0
 
      
 
    for serial in [start..1000]
 
      uri = @Uri("#{base}#{serial}")
 
      if not @contains(uri, null, null)
 
        results.push(uri)
 
        log('nextNumberedResources', "picked #{uri}")
 
        @_nextNumber.set(base, serial + 1)
 
        if results.length >= howMany
 
          return results
 
    throw new Error("can't make sequential uri with base #{base}")
 

	
 
  nextNumberedResource: (base) ->
light9/web/live/live.coffee
Show inline comments
 
@@ -293,12 +293,13 @@ class GraphToControls
 
    @graph.applyAndSendPatch(patch)
 
    return effect
 

	
 
  syncFromGraph: ->
 
    U = (x) => @graph.Uri(x)
 
    return if not @effect
 
    log('syncFromGraph', @effect)
 
    
 
    toClear = new Set(@activeSettings.allSettingsStr())
 
    
 
    for setting in @graph.objects(@effect, U(':setting'))
 
      dev = @graph.uriValue(setting, U(':device'))
 
      devAttr = @graph.uriValue(setting, U(':deviceAttr'))
0 comments (0 inline, 0 general)