mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-06 23:23:16 +00:00
enabled subclasses of CPSet to use CPObjects "addObserver:/removeObserver:" methods without throwing exception
This commit is contained in:
1 parent
c1fd31fa23
commit
dfba974572
1 file changed
+9
-3
@@ -529,12 +529,18 @@ kvoOperators["sum"] = function sumOperator(self, _cmd, param)
|
||||
|
||||
- (void)addObserver:(id)observer forKeyPath:(CPString)aKeyPath options:(unsigned)options context:(id)context
|
||||
{
|
||||
[CPException raise:@"CPKeyValueObservingException" reason:@"CPSet is not key-value observable"];
|
||||
if ([isa instanceMethodForSelector:_cmd] === [CPSet instanceMethodForSelector:_cmd])
|
||||
[CPException raise:CPInvalidArgumentException reason:"Unsupported method on CPSet"];
|
||||
else
|
||||
[super addObserver:observer forKeyPath:aKeyPath options:options context:context];
|
||||
}
|
||||
|
||||
- (void)removeObserver:(id)observer forKeyPath:(CPString)aKeyPath
|
||||
-(void)removeObserver:(id)observer forKeyPath:(CPString)aKeyPath
|
||||
{
|
||||
[CPException raise:@"CPKeyValueObservingException" reason:@"CPSet is not key-value observable"];
|
||||
if ([isa instanceMethodForSelector:_cmd] === [CPSet instanceMethodForSelector:_cmd])
|
||||
[CPException raise:CPInvalidArgumentException reason:"Unsupported method on CPSet"];
|
||||
else
|
||||
[super removeObserver:observer forKeyPath:aKeyPath];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user