Advertisement
duck

example of JS dictionary, enum, data storage

Apr 12th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma strict
  2. import System.Collections.Generic;
  3.  
  4. public static class FeedCache {
  5.  
  6.     public enum CacheItem {
  7.         MeetingRooms,
  8.         PublicSpaces,
  9.         DepartmentCenters,
  10.         PreferredEntrances,
  11.         Videos,
  12.         Furniture
  13.     };
  14.  
  15.     public var data = new Dictionary.<CacheItem,Array>();
  16.    
  17.     public function Get(cacheItem : CacheItem) : Array {
  18.         return data[cacheItem];
  19.     }
  20.    
  21.     public function Set(cacheItem : CacheItem, data : Array) : void {
  22.         data[cacheItem] = data;
  23.     }
  24.    
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement