Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
todomvc
Commits
9df98e41
Commit
9df98e41
authored
Nov 22, 2014
by
Olivier Scherrer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Olives: Update Olives and Emily to latest 1.x versions
parent
b9c3b488
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
3934 additions
and
2909 deletions
+3934
-2909
examples/olives/bower.json
examples/olives/bower.json
+2
-2
examples/olives/bower_components/emily/build/Emily.js
examples/olives/bower_components/emily/build/Emily.js
+1423
-1005
examples/olives/bower_components/olives/build/Olives.js
examples/olives/bower_components/olives/build/Olives.js
+1518
-964
examples/olives/bower_components/olives/src/Bind.plugin.js
examples/olives/bower_components/olives/src/Bind.plugin.js
+604
-573
examples/olives/bower_components/olives/src/DomUtils.js
examples/olives/bower_components/olives/src/DomUtils.js
+2
-0
examples/olives/bower_components/olives/src/Event.plugin.js
examples/olives/bower_components/olives/src/Event.plugin.js
+118
-116
examples/olives/bower_components/olives/src/LocalStore.js
examples/olives/bower_components/olives/src/LocalStore.js
+3
-1
examples/olives/bower_components/olives/src/OObject.js
examples/olives/bower_components/olives/src/OObject.js
+180
-174
examples/olives/bower_components/olives/src/Place.plugin.js
examples/olives/bower_components/olives/src/Place.plugin.js
+67
-65
examples/olives/bower_components/olives/src/Plugins.js
examples/olives/bower_components/olives/src/Plugins.js
+2
-0
examples/olives/bower_components/olives/src/SocketIOTransport.js
...s/olives/bower_components/olives/src/SocketIOTransport.js
+15
-9
No files found.
examples/olives/bower.json
View file @
9df98e41
...
...
@@ -2,8 +2,8 @@
"name"
:
"todomvc-olives"
,
"version"
:
"0.0.0"
,
"dependencies"
:
{
"olives"
:
"~1.
4
.0"
,
"emily"
:
"~1.
3.5
"
,
"olives"
:
"~1.
6
.0"
,
"emily"
:
"~1.
8.1
"
,
"requirejs"
:
"~2.1.5"
,
"todomvc-common"
:
"~0.3.0"
}
...
...
examples/olives/bower_components/emily/build/Emily.js
View file @
9df98e41
This diff is collapsed.
Click to expand it.
examples/olives/bower_components/olives/build/Olives.js
View file @
9df98e41
This diff is collapsed.
Click to expand it.
examples/olives/bower_components/olives/src/Bind.plugin.js
View file @
9df98e41
This diff is collapsed.
Click to expand it.
examples/olives/bower_components/olives/src/DomUtils.js
View file @
9df98e41
...
...
@@ -6,6 +6,8 @@
define
([
"
Tools
"
],
function
(
Tools
)
{
"
use strict
"
;
return
{
/**
* Returns a NodeList including the given dom node,
...
...
examples/olives/bower_components/olives/src/Event.plugin.js
View file @
9df98e41
...
...
@@ -14,121 +14,123 @@ define(["DomUtils"],
*/
function
EventPlugin
(
Utils
)
{
/**
* The event plugin constructor.
* ex: new EventPlugin({method: function(){} ...}, false);
* @param {Object} the object that has the event handling methods
* @param {Boolean} $isMobile if the event handler has to map with touch events
*/
return
function
EventPluginConstructor
(
$parent
,
$isMobile
)
{
/**
* The parent callback
* @private
*/
var
_parent
=
null
,
/**
* The mapping object.
* @private
*/
_map
=
{
"
mousedown
"
:
"
touchstart
"
,
"
mouseup
"
:
"
touchend
"
,
"
mousemove
"
:
"
touchmove
"
},
/**
* Is touch device.
* @private
*/
_isMobile
=
!!
$isMobile
;
/**
* Add mapped event listener (for testing purpose).
* @private
*/
this
.
addEventListener
=
function
addEventListener
(
node
,
event
,
callback
,
useCapture
)
{
node
.
addEventListener
(
this
.
map
(
event
),
callback
,
!!
useCapture
);
};
/**
* Listen to DOM events.
* @param {Object} node DOM node
* @param {String} name event's name
* @param {String} listener callback's name
* @param {String} useCapture string
*/
this
.
listen
=
function
listen
(
node
,
name
,
listener
,
useCapture
)
{
this
.
addEventListener
(
node
,
name
,
function
(
e
){
_parent
[
listener
].
call
(
_parent
,
e
,
node
);
},
!!
useCapture
);
};
/**
* Delegate the event handling to a parent DOM element
* @param {Object} node DOM node
* @param {String} selector CSS3 selector to the element that listens to the event
* @param {String} name event's name
* @param {String} listener callback's name
* @param {String} useCapture string
*/
this
.
delegate
=
function
delegate
(
node
,
selector
,
name
,
listener
,
useCapture
)
{
this
.
addEventListener
(
node
,
name
,
function
(
event
){
if
(
Utils
.
matches
(
node
,
selector
,
event
.
target
))
{
_parent
[
listener
].
call
(
_parent
,
event
,
node
);
}
},
!!
useCapture
);
};
/**
* Get the parent object.
* @return {Object} the parent object
*/
this
.
getParent
=
function
getParent
()
{
return
_parent
;
};
/**
* Set the parent object.
* The parent object is an object which the functions are called by node listeners.
* @param {Object} the parent object
* @return true if object has been set
*/
this
.
setParent
=
function
setParent
(
parent
)
{
if
(
parent
instanceof
Object
){
_parent
=
parent
;
return
true
;
}
return
false
;
};
/**
* Get event mapping.
* @param {String} event's name
* @return the mapped event's name
*/
this
.
map
=
function
map
(
name
)
{
return
_isMobile
?
(
_map
[
name
]
||
name
)
:
name
;
};
/**
* Set event mapping.
* @param {String} event's name
* @param {String} event's value
* @return true if mapped
*/
this
.
setMap
=
function
setMap
(
name
,
value
)
{
if
(
typeof
name
==
"
string
"
&&
typeof
value
==
"
string
"
)
{
_map
[
name
]
=
value
;
return
true
;
}
return
false
;
};
//init
this
.
setParent
(
$parent
);
};
"
use strict
"
;
/**
* The event plugin constructor.
* ex: new EventPlugin({method: function(){} ...}, false);
* @param {Object} the object that has the event handling methods
* @param {Boolean} $isMobile if the event handler has to map with touch events
*/
return
function
EventPluginConstructor
(
$parent
,
$isMobile
)
{
/**
* The parent callback
* @private
*/
var
_parent
=
null
,
/**
* The mapping object.
* @private
*/
_map
=
{
"
mousedown
"
:
"
touchstart
"
,
"
mouseup
"
:
"
touchend
"
,
"
mousemove
"
:
"
touchmove
"
},
/**
* Is touch device.
* @private
*/
_isMobile
=
!!
$isMobile
;
/**
* Add mapped event listener (for testing purpose).
* @private
*/
this
.
addEventListener
=
function
addEventListener
(
node
,
event
,
callback
,
useCapture
)
{
node
.
addEventListener
(
this
.
map
(
event
),
callback
,
!!
useCapture
);
};
/**
* Listen to DOM events.
* @param {Object} node DOM node
* @param {String} name event's name
* @param {String} listener callback's name
* @param {String} useCapture string
*/
this
.
listen
=
function
listen
(
node
,
name
,
listener
,
useCapture
)
{
this
.
addEventListener
(
node
,
name
,
function
(
e
){
_parent
[
listener
].
call
(
_parent
,
e
,
node
);
},
!!
useCapture
);
};
/**
* Delegate the event handling to a parent DOM element
* @param {Object} node DOM node
* @param {String} selector CSS3 selector to the element that listens to the event
* @param {String} name event's name
* @param {String} listener callback's name
* @param {String} useCapture string
*/
this
.
delegate
=
function
delegate
(
node
,
selector
,
name
,
listener
,
useCapture
)
{
this
.
addEventListener
(
node
,
name
,
function
(
event
){
if
(
Utils
.
matches
(
node
,
selector
,
event
.
target
))
{
_parent
[
listener
].
call
(
_parent
,
event
,
node
);
}
},
!!
useCapture
);
};
/**
* Get the parent object.
* @return {Object} the parent object
*/
this
.
getParent
=
function
getParent
()
{
return
_parent
;
};
/**
* Set the parent object.
* The parent object is an object which the functions are called by node listeners.
* @param {Object} the parent object
* @return true if object has been set
*/
this
.
setParent
=
function
setParent
(
parent
)
{
if
(
parent
instanceof
Object
){
_parent
=
parent
;
return
true
;
}
return
false
;
};
/**
* Get event mapping.
* @param {String} event's name
* @return the mapped event's name
*/
this
.
map
=
function
map
(
name
)
{
return
_isMobile
?
(
_map
[
name
]
||
name
)
:
name
;
};
/**
* Set event mapping.
* @param {String} event's name
* @param {String} event's value
* @return true if mapped
*/
this
.
setMap
=
function
setMap
(
name
,
value
)
{
if
(
typeof
name
==
"
string
"
&&
typeof
value
==
"
string
"
)
{
_map
[
name
]
=
value
;
return
true
;
}
return
false
;
};
//init
this
.
setParent
(
$parent
);
};
});
examples/olives/bower_components/olives/src/LocalStore.js
View file @
9df98e41
...
...
@@ -15,6 +15,8 @@ define(["Store", "Tools"],
*/
function
LocalStore
(
Store
,
Tools
)
{
"
use strict
"
;
function
LocalStoreConstructor
()
{
/**
...
...
@@ -96,7 +98,7 @@ function LocalStore(Store, Tools) {
return
function
LocalStoreFactory
(
init
)
{
LocalStoreConstructor
.
prototype
=
new
Store
(
init
);
return
new
LocalStoreConstructor
;
return
new
LocalStoreConstructor
()
;
};
});
examples/olives/bower_components/olives/src/OObject.js
View file @
9df98e41
This diff is collapsed.
Click to expand it.
examples/olives/bower_components/olives/src/Place.plugin.js
View file @
9df98e41
...
...
@@ -12,77 +12,79 @@ define(["OObject", "Tools"],
*/
function
PlacePlugin
(
OObject
,
Tools
)
{
/**
* Intilialize a Place.plugin with a list of OObjects
* @param {Object} $uis a list of OObjects such as:
* {
* "header": new OObject(),
* "list": new OObject()
* }
* @Constructor
*/
return
function
PlacePluginConstructor
(
$uis
)
{
"
use strict
"
;
/**
* The list of uis currently set in this place plugin
* @private
*/
var
_uis
=
{};
/**
* Intilialize a Place.plugin with a list of OObjects
* @param {Object} $uis a list of OObjects such as:
* {
* "header": new OObject(),
* "list": new OObject()
* }
* @Constructor
*/
return
function
PlacePluginConstructor
(
$uis
)
{
/**
* Attach an OObject to this DOM element
* @param {HTML|SVGElement} node the dom node where to attach the OObject
* @param {String} the name of the OObject to attach
* @throws {NoSuchOObject} an error if there's no OObject for the given name
*/
this
.
place
=
function
place
(
node
,
name
)
{
if
(
_uis
[
name
]
instanceof
OObject
)
{
_uis
[
name
].
place
(
node
);
}
else
{
throw
new
Error
(
name
+
"
is not an OObject UI in place:
"
+
name
);
}
};
/**
* The list of uis currently set in this place plugin
* @private
*/
var
_uis
=
{};
/**
* Add an OObject that can be attached to a dom element
* @param {String} the name of the OObject to add to the list
* @param {OObject} ui the OObject to add the list
* @returns {Boolean} true if the OObject was added
*/
this
.
set
=
function
set
(
name
,
ui
)
{
if
(
typeof
name
==
"
string
"
&&
ui
instanceof
OObject
)
{
_uis
[
name
]
=
ui
;
return
true
;
}
else
{
return
false
;
}
};
/**
* Attach an OObject to this DOM element
* @param {HTML|SVGElement} node the dom node where to attach the OObject
* @param {String} the name of the OObject to attach
* @throws {NoSuchOObject} an error if there's no OObject for the given name
*/
this
.
place
=
function
place
(
node
,
name
)
{
if
(
_uis
[
name
]
instanceof
OObject
)
{
_uis
[
name
].
place
(
node
);
}
else
{
throw
new
Error
(
name
+
"
is not an OObject UI in place:
"
+
name
);
}
};
/**
* Add multiple dom elements at once
* @param {Object} $uis a list of OObjects such as:
* {
* "header": new OObject(),
* "list": new OObject()
* }
*/
this
.
setAll
=
function
setAll
(
uis
)
{
Tools
.
loop
(
uis
,
function
(
ui
,
name
)
{
this
.
set
(
name
,
ui
);
},
this
);
};
/**
* Add an OObject that can be attached to a dom element
* @param {String} the name of the OObject to add to the list
* @param {OObject} ui the OObject to add the list
* @returns {Boolean} true if the OObject was added
*/
this
.
set
=
function
set
(
name
,
ui
)
{
if
(
typeof
name
==
"
string
"
&&
ui
instanceof
OObject
)
{
_uis
[
name
]
=
ui
;
return
true
;
}
else
{
return
false
;
}
};
/**
* Returns an OObject from the list given its name
* @param {String} the name of the OObject to get
* @returns {OObject} OObject for the given name
*/
this
.
get
=
function
get
(
name
)
{
return
_uis
[
name
];
};
/**
* Add multiple dom elements at once
* @param {Object} $uis a list of OObjects such as:
* {
* "header": new OObject(),
* "list": new OObject()
* }
*/
this
.
setAll
=
function
setAll
(
uis
)
{
Tools
.
loop
(
uis
,
function
(
ui
,
name
)
{
this
.
set
(
name
,
ui
);
},
this
);
};
this
.
setAll
(
$uis
);
/**
* Returns an OObject from the list given its name
* @param {String} the name of the OObject to get
* @returns {OObject} OObject for the given name
*/
this
.
get
=
function
get
(
name
)
{
return
_uis
[
name
];
};
};
this
.
setAll
(
$uis
);
};
});
examples/olives/bower_components/olives/src/Plugins.js
View file @
9df98e41
...
...
@@ -17,6 +17,8 @@ define(["Tools", "DomUtils"],
*/
function
Plugins
(
Tools
,
DomUtils
)
{
"
use strict
"
;
return
function
PluginsConstructor
(
$plugins
)
{
/**
...
...
examples/olives/bower_components/olives/src/SocketIOTransport.js
View file @
9df98e41
...
...
@@ -12,6 +12,8 @@ define(["Observable", "Tools"],
*/
function
SocketIOTransport
(
Observable
,
Tools
)
{
"
use strict
"
;
/**
* Defines the SocketIOTransport
* @private
...
...
@@ -47,7 +49,7 @@ function SocketIOTransport(Observable, Tools) {
*/
this
.
getSocket
=
function
getSocket
()
{
return
_socket
;
}
,
}
;
/**
* Subscribe to a socket event
...
...
@@ -56,7 +58,7 @@ function SocketIOTransport(Observable, Tools) {
*/
this
.
on
=
function
on
(
event
,
func
)
{
return
_socket
.
on
(
event
,
func
);
}
,
}
;
/**
* Subscribe to a socket event but disconnect as soon as it fires.
...
...
@@ -95,15 +97,17 @@ function SocketIOTransport(Observable, Tools) {
* @param {Object} scope the scope in which to execute the callback
*/
this
.
request
=
function
request
(
channel
,
data
,
func
,
scope
)
{
if
(
typeof
channel
==
"
string
"
&&
typeof
data
!=
"
undefined
"
)
{
if
(
typeof
channel
==
"
string
"
&&
typeof
data
!=
"
undefined
"
)
{
var
reqData
=
{
eventId
:
Date
.
now
()
+
Math
.
floor
(
Math
.
random
()
*
1
e6
),
data
:
data
},
boundCallback
=
function
()
{
func
&&
func
.
apply
(
scope
||
null
,
arguments
);
if
(
func
)
{
func
.
apply
(
scope
||
null
,
arguments
);
}
};
this
.
once
(
reqData
.
eventId
,
boundCallback
);
...
...
@@ -125,9 +129,9 @@ function SocketIOTransport(Observable, Tools) {
* @returns
*/
this
.
listen
=
function
listen
(
channel
,
data
,
func
,
scope
)
{
if
(
typeof
channel
==
"
string
"
&&
typeof
data
!=
"
undefined
"
&&
typeof
func
==
"
function
"
)
{
if
(
typeof
channel
==
"
string
"
&&
typeof
data
!=
"
undefined
"
&&
typeof
func
==
"
function
"
)
{
var
reqData
=
{
eventId
:
Date
.
now
()
+
Math
.
floor
(
Math
.
random
()
*
1
e6
),
...
...
@@ -135,7 +139,9 @@ function SocketIOTransport(Observable, Tools) {
keepAlive
:
true
},
boundCallback
=
function
()
{
func
&&
func
.
apply
(
scope
||
null
,
arguments
);
if
(
func
)
{
func
.
apply
(
scope
||
null
,
arguments
);
}
},
that
=
this
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment