Commit Graph
1128 Commits
Author SHA1 Message Date
cacaodev a1926982c6 Fixed: make CPObject implementsSelector: work with proxies and KVO swizzled classes 2016-05-12 21:43:44 +02:00
Martin Carlbergandcacaodev ae5d31746e Dependent key paths use a relationship (#2431)
Fixed: When dependent key paths use a relationship, only the first added observer will observe the attribute for the relationship object.

Also, an optimisation on when the willChange… chain is running, there is no need to replace the observers as no new values are set yet. That will be done when the didChange… chain is running.
2016-05-09 22:14:20 +02:00
Martin Carlberg 5c60819668 Merge pull request #2432 from Dogild/CacheURLRequest
Fixed: cache control was not set properly in CPURLRequest
2016-04-05 19:05:59 +02:00
Antoine Mercadal 598a6ebaed Merge pull request #2278 from cacaodev/CPAnimationContext
Animations: CPAnimationContext & animator
2016-04-04 09:57:55 -07:00
Alexander Ljungberg 42d7e4312b Formatting of CPCache. 2016-04-02 01:20:23 +01:00
Alexander Ljungberg 41a741724f New: Sweden / Swedish as a possible locale. 2016-04-01 23:47:13 +01:00
Alexander Ljungberg e13f5ed730 Fixed: CPNumber intValue did not return an integer.
We expect this method to return a whole number like in Objective-C. This also goes for the related methods, `shortValue`, `longValue` and `longLongValue`.

Also adds more tests (in addition to the existing, already failing test).
2016-04-01 22:22:03 +01:00
Alexandre Wilhelm 500fa7f314 Fixed: cache control was not set properly in CPURLRequest 2016-03-28 23:32:48 -07:00
Martin Carlberg b208571ed7 Fixed: Formatting 2016-03-23 10:17:15 +01:00
Martin Carlberg 7780a98abe Fixed: Added ’integerValue’ method for CPNumber and CPString.
This makes the classes more compliant to Cocoa
2016-03-15 22:25:10 +01:00
cacaodev 6fd2d12d3f Merge remote-tracking branch 'cappuccino/master' into CPAnimationContext 2016-03-12 23:29:46 +01:00
Alexandre Wilhelm a995f3ab52 Merge pull request #2424 from mrcarlberg/invalid_plist_fix
Does not throw exception if plist is not valid. It will return nil instead
2016-03-05 13:32:15 -08:00
Martin Carlberg ec55bddbd4 Fixed: Does not throw exception if plist is not valid. It will return nil instead. 2016-03-01 21:45:08 +01:00
cacaodev 65dee154f7 Remove ignored argument _ 2016-02-06 20:39:49 +01:00
cacaodev d07d8f6857 _CPBlockExpression: replace loops with arrayByApplyingBlock: method 2016-02-04 21:51:37 +01:00
cacaodev 0327f6b1ea Merge remote-tracking branch 'cappuccino/master' into CPArray-arrayByApplyingBlock-replace 2016-02-04 21:46:10 +01:00
cacaodev 6b683bd02d Merge pull request #2402 from cacaodev/CPExpression-constructors
NEW : CPExpression +expressionForBlock:arguments:
                                   +expressionForConditional:trueExpression:falseExpression:
2016-01-25 10:22:18 +01:00
cacaodev 095a978120 Replace loops with arrayByApplyingBlock: 2016-01-17 20:54:43 +01:00
cacaodev 1b72646772 Style: remove tabs 2016-01-17 20:54:20 +01:00
cacaodev e172217427 Merge pull request #2404 from cacaodev/CPArray-mapUsingBlock
New: CPArray -arrayByApplyingBlock:
2016-01-16 19:25:07 +01:00
cacaodev 8c67eee4c8 (CPArray)arrayByApplyingBlock: documentation 2016-01-16 18:28:04 +01:00
Antoine Mercadal 5d88d07edc FIXED: CPPredicate's predicateFormat with a CPNull value as right expression wasn't working
Previously a CPPredicate created with format `value == nil` was converted back to `value == <CPNull @ xxxx>`

This patch ensures `predicateFormat` returns `value == nil`

Test added in CPPredicateTest.j
2016-01-14 15:50:24 -08:00
cacaodev 08aa591c65 NEW CPArray -arrayByApplyingBlock:(Function/*element, index*/)aBlock
Test for CPArray -arrayByApplyingBlock:
2016-01-14 21:57:57 +01:00
cacaodev 36c417458d STYLE: replaced expression methods with accessors
Also added methods and documentation for the new methods:
-trueExpression, -falseExpression and -expressionBlock.
Completed documentation for -predicate and -arguments.
2015-12-27 22:08:30 +01:00
cacaodev f1591e593a Coding style 2015-12-27 22:03:35 +01:00
cacaodev 117ac0f5d6 FIXED: replace js Array.map function with capp API
Also fixed BlockExpression description to match a little more with
cocoa impl.
2015-12-27 19:31:05 +01:00
cacaodev e72a42fd2d FIXED: block & conditional expressions: support for CPPredicate -predicateWithSubstitutionVariables: 2015-12-27 19:28:03 +01:00
cacaodev 07b6e2b9f1 CPExpression +expressionForConditional:trueExpression:falseExpression:
Conditional Expression : an expression using different expressions for
evaluation, depending of a predicate result.

Support for predicate parsing: ```TERNARY(predicate, trueExpression,
falseExpression)```

With init, equal, evaluation, parsing tests.
2015-12-27 15:45:03 +01:00
cacaodev 5ab10f4024 NEW: CPExpression +expressionForBlock:arguments:
An expression that returns the result of evaluating a block.

With tests.
2015-12-27 15:44:36 +01:00
cacaodev 0ac08456bc Merge pull request #2401 from cacaodev/CPSubqueryExpression
FIXED: Subquery expressions were ignoring evaluation context
2015-12-26 00:12:13 +01:00
cacaodev 80a3549ef5 FIXED: Subquery expressions were ignoring evaluation context
When the predicate part of a subquery expression was containing
variables, the substitution was ignored.
Now, the subpredicate can contain variables that will be substituted
when calling evaluateWithObject:substitutionVariables:.

Added expression test and predicate parsing test.
2015-12-23 18:49:07 +01:00
Alexandre Wilhelm b59b0259ca Fixed: CPDateFormatter did not work with symbols MM and LL with the month of december 2015-12-09 10:51:51 -08:00
Martin Carlberg 758ad3eb06 Fixed: Method types was not copied into new KVO implementation of a class that is observed with KVO.
Some test cases are also added for this.
2015-11-20 12:43:53 +01:00
Martin Carlberg 8c2f0bacf1 Merge pull request #2384 from mrcarlberg/even_faster_objj_msg_send
Speedup of the Cappuccino framework by more efficient objj_msgSend
2015-11-01 20:39:18 +01:00
Alexandre Wilhelm 4d1dc0c949 New: added the method performBlock in CPRunLoop
Previously, we could only give a selector and a target for perform in the runLoop. Now we can give a block.
This feature is used in the CPTextField class. Previously, when we wanted to call a function at the end of the stack we used window.setTimeout, however due to HTML5 specifications this wasn't called just at the end of the stack but at least 4ms (more information here https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout#Minimum_delay_and_timeout_nesting). Now we give a block to perform, and this block will be performed in the next runloop.

Unittest has been added in Tests/Foundation/CPRunLoopTest.j
2015-10-26 15:36:13 -07:00
Martin Carlberg 5541381afe Fixed: Only have one ’release’ option for Jake.
Removed the ’release-inline’ option when building as it is not practical to have two different options. The release build now always has inlined msgSend functions. If a release build is needed without inlined msgSend functions an edit of the ”-O2” option to ”-O” in the Jakefile is needed.
2015-10-26 09:53:39 +01:00
Alexandre Wilhelm db3c232173 Fixed: add CPNotificationQueue.j in Foundation.j 2015-10-08 16:07:50 -07:00
Alexandre Wilhelm 22b77af9d3 New: added the class CPNotificationQueue
This PR adds the feature of CPNotificationQueue.

Cappuccino provides a framework for sending messages between objects within
a process called notifications. CPNotificationQueue objects (or simply notification queues)
act as buffers for notification centers (instances of CPNotificationCenter).
Whereas a notification center distributes notifications when posted,
notifications placed into the queue can be delayed until the end of the current pass through the run loop
or until the run loop is idle. Duplicate notifications can also be coalesced so that only one notification
is sent although multiple notifications are posted. A notification queue maintains notifications
(instances of C¨Notification) generally in a first in first out (FIFO) order.
When a notification rises to the front of the queue, the queue posts it to the notification center,
which in turn dispatches the notification to all objects registered as observers.

More informations here :https://developer.apple.com/library/prerelease/ios/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationQueue_Class/index.html#//apple_ref/occ/instm/NSNotificationQueue/enqueueNotification:postingStyle:coalesceMask:forModes:

Unit-Tests in Tests/Foundation/CPNotificationQueueTest.j
2015-10-08 16:06:16 -07:00
Alexandre Wilhelm 3e29732e46 Fixed: OperationQueue for the CPNotificationCenter is not ignored anymore
Previously, the operationQueue given to the notificationCenter was ignored.

Tests in CPNotificationCenterTest.j
2015-10-08 11:23:07 -07:00
Alexandre Wilhelm 8809c1634f Merge pull request #2286 from cacaodev/CPURLConnection
CPURLConnection +sendAsynchronousRequest:queue:completionHandler:
2015-10-08 10:25:12 -07:00
Martin Carlberg e45e31d223 Fixed: Introduce ’jake install-inline’ task to generate the cappuccino framework with objj_msgSend function inlined. Also introduced options in ’index-debug.html’ templates to allow inline of objj_msgSend function when compiling in browser. 2015-10-06 13:34:28 +02:00
Martin Carlberg 4b81e0d8af Merge pull request #2383 from mrcarlberg/use_more_fast_objj__msg_send
Use the faster objj_msgSend instead of the old slower objj_msgSend
2015-10-02 20:35:32 +02:00
Alexandre Wilhelm 686f931fb4 Merge pull request #2343 from Dogild/Localization
New: first work on localization
2015-10-02 11:04:35 -07:00
Martin Carlberg e5e50c2220 Fixed: Use the faster objj_msgSend instead of the old slower objj_msgSend
In some places the objj_msgSend function is called directly. Most of the times the old slower version is called. This commit will use the never faster version instead.
2015-10-01 22:17:13 +02:00
cacaodev e8da7baee2 Perform operation on network error (try/catch). 2015-10-01 13:19:40 +02:00
cacaodev 8ab9e6bac7 NEW +sendAsynchronousRequest:queue:completionHandler: If queue is nil, run handler immediately.
NEW: CPURLConnection -operation method, CPError CPURLErrorDomain constant.

    CPURLConnection -operation gives access to the operation generated by the new CPURLConnection creator.
    This allows to create dependencies between operations and setup priorities early.
    When the connection fails with a status code 404 or is cancelled, the
    operation is also cancelled and
    the next operation in the queue is started.
2015-10-01 12:36:57 +02:00
Martin Carlberg 5d415e6679 Fixed: Speed improvement 2015-09-30 16:59:16 +02:00
Martin Carlberg 3a7384ec26 Fixed: CPDictionary initWithObjectsAndKeys was not compliant with Cocoa or the init method ’initWithObjects:forKeys:’ when duplicated keys was passed to the method.
Test cases are also added
2015-09-30 16:59:04 +02:00
Alexandre Wilhelm 32b7a314b1 Fixed: warning when compiling Foundation adn CPException 2015-09-29 15:36:22 -07:00
Martin Carlberg 8599ad4a3c Fixed: The init method ’initWithObjects:count:’ for CPArray did not work on native CPJavaScriptArray when ’count’ is not the same as the length on the provided array.
A test case for this is also added in the test class CPArrayTest
2015-09-25 17:07:15 +02:00