From e7bb334c6ad172c648a79b2d7f764f521cedde33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 11 Feb 2013 18:59:49 -0800 Subject: [PATCH] Use JSON dictionary support to serialize Symbols and PlacedSymbol references. --- src/item/PlacedSymbol.js | 3 +++ src/project/Symbol.js | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/item/PlacedSymbol.js b/src/item/PlacedSymbol.js index 359185e4..7c60d915 100644 --- a/src/item/PlacedSymbol.js +++ b/src/item/PlacedSymbol.js @@ -20,6 +20,9 @@ */ var PlacedSymbol = this.PlacedSymbol = PlacedItem.extend(/** @lends PlacedSymbol# */{ _type: 'placedsymbol', + _serializeFields: { + symbol: null + }, /** * Creates a new PlacedSymbol Item. * diff --git a/src/project/Symbol.js b/src/project/Symbol.js index 139907c7..3754c28e 100644 --- a/src/project/Symbol.js +++ b/src/project/Symbol.js @@ -68,6 +68,11 @@ var Symbol = this.Symbol = Base.extend(/** @lends Symbol# */{ this._instances = {}; }, + _serialize: function(dictionary) { + return dictionary.get(this) || dictionary.set(this, [this._type, + Base.serialize(this._definition, false, dictionary)]); + }, + // TODO: Symbol#remove() // TODO: Symbol#name (accessible by name through project#symbols)