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
Show 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 @@
...
@@ -2,8 +2,8 @@
"name"
:
"todomvc-olives"
,
"name"
:
"todomvc-olives"
,
"version"
:
"0.0.0"
,
"version"
:
"0.0.0"
,
"dependencies"
:
{
"dependencies"
:
{
"olives"
:
"~1.
4
.0"
,
"olives"
:
"~1.
6
.0"
,
"emily"
:
"~1.
3.5
"
,
"emily"
:
"~1.
8.1
"
,
"requirejs"
:
"~2.1.5"
,
"requirejs"
:
"~2.1.5"
,
"todomvc-common"
:
"~0.3.0"
"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
...
@@ -13,6 +13,8 @@ define(["Store", "Observable", "Tools", "DomUtils"],
...
@@ -13,6 +13,8 @@ define(["Store", "Observable", "Tools", "DomUtils"],
*/
*/
function
BindPlugin
(
Store
,
Observable
,
Tools
,
DomUtils
)
{
function
BindPlugin
(
Store
,
Observable
,
Tools
,
DomUtils
)
{
"
use strict
"
;
return
function
BindPluginConstructor
(
$model
,
$bindings
)
{
return
function
BindPluginConstructor
(
$model
,
$bindings
)
{
/**
/**
...
@@ -32,14 +34,28 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -32,14 +34,28 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
* each foreach has its itemRenderer
* each foreach has its itemRenderer
* @private
* @private
*/
*/
_itemRenderers
=
{};
_itemRenderers
=
{},
/**
/**
* The observers handlers
* The observers handlers
* for debugging only
* @private
* @private
*/
*/
this
.
observers
=
{};
_observers
=
{};
/**
* Exposed for debugging purpose
* @private
*/
this
.
observers
=
_observers
;
function
_removeObserversForId
(
id
)
{
if
(
_observers
[
id
])
{
_observers
[
id
].
forEach
(
function
(
handler
)
{
_model
.
unwatchValue
(
handler
);
});
delete
_observers
[
id
];
}
}
/**
/**
* Define the model to watch for
* Define the model to watch for
...
@@ -133,7 +149,9 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -133,7 +149,9 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
_rootNode
=
rootNode
;
_rootNode
=
rootNode
;
renderer
=
_rootNode
.
querySelector
(
"
*
"
);
renderer
=
_rootNode
.
querySelector
(
"
*
"
);
this
.
setRenderer
(
renderer
);
this
.
setRenderer
(
renderer
);
renderer
&&
_rootNode
.
removeChild
(
renderer
);
if
(
renderer
)
{
_rootNode
.
removeChild
(
renderer
);
}
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
...
@@ -173,7 +191,7 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -173,7 +191,7 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
* The nodes created from the items are stored here
* The nodes created from the items are stored here
* @private
* @private
*/
*/
this
.
items
=
new
Store
([])
;
this
.
items
=
{}
;
/**
/**
* Set the start limit
* Set the start limit
...
@@ -182,7 +200,8 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -182,7 +200,8 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
* @returns the value
* @returns the value
*/
*/
this
.
setStart
=
function
setStart
(
start
)
{
this
.
setStart
=
function
setStart
(
start
)
{
return
_start
=
parseInt
(
start
,
10
);
_start
=
parseInt
(
start
,
10
);
return
_start
;
};
};
/**
/**
...
@@ -201,7 +220,8 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -201,7 +220,8 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
* @returns the value
* @returns the value
*/
*/
this
.
setNb
=
function
setNb
(
nb
)
{
this
.
setNb
=
function
setNb
(
nb
)
{
return
_nb
=
nb
==
"
*
"
?
nb
:
parseInt
(
nb
,
10
);
_nb
=
nb
==
"
*
"
?
nb
:
parseInt
(
nb
,
10
);
return
_nb
;
};
};
/**
/**
...
@@ -223,12 +243,16 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -223,12 +243,16 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
var
node
,
var
node
,
next
;
next
;
if
(
typeof
id
==
"
number
"
&&
!
this
.
items
.
get
(
id
))
{
if
(
typeof
id
==
"
number
"
&&
!
this
.
items
[
id
])
{
next
=
this
.
getNextItem
(
id
);
node
=
this
.
create
(
id
);
node
=
this
.
create
(
id
);
if
(
node
)
{
if
(
node
)
{
// IE (until 9) apparently fails to appendChild when insertBefore's second argument is null, hence this.
// IE (until 9) apparently fails to appendChild when insertBefore's second argument is null, hence this.
next
=
this
.
getNextItem
(
id
);
if
(
next
)
{
next
?
_rootNode
.
insertBefore
(
node
,
next
)
:
_rootNode
.
appendChild
(
node
);
_rootNode
.
insertBefore
(
node
,
next
);
}
else
{
_rootNode
.
appendChild
(
node
);
}
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
...
@@ -245,11 +269,18 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -245,11 +269,18 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
* @returns
* @returns
*/
*/
this
.
getNextItem
=
function
getNextItem
(
id
)
{
this
.
getNextItem
=
function
getNextItem
(
id
)
{
return
this
.
items
.
alter
(
"
slice
"
,
id
+
1
).
filter
(
function
(
value
)
{
var
keys
=
Object
.
keys
(
this
.
items
).
map
(
function
(
string
)
{
if
(
DomUtils
.
isAcceptedType
(
value
))
{
return
Number
(
string
);
return
true
;
}),
closest
=
Tools
.
closestGreater
(
id
,
keys
),
closestId
=
keys
[
closest
];
// Only return if different
if
(
closestId
!=
id
)
{
return
this
.
items
[
closestId
];
}
else
{
return
;
}
}
})[
0
];
};
};
/**
/**
...
@@ -259,10 +290,11 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -259,10 +290,11 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
* @returns
* @returns
*/
*/
this
.
removeItem
=
function
removeItem
(
id
)
{
this
.
removeItem
=
function
removeItem
(
id
)
{
var
item
=
this
.
items
.
get
(
id
)
;
var
item
=
this
.
items
[
id
]
;
if
(
item
)
{
if
(
item
)
{
_rootNode
.
removeChild
(
item
);
_rootNode
.
removeChild
(
item
);
this
.
items
.
set
(
id
);
delete
this
.
items
[
id
];
_removeObserversForId
(
id
);
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
...
@@ -286,7 +318,7 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -286,7 +318,7 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
child
.
setAttribute
(
"
data-
"
+
_plugins
.
name
+
"
_id
"
,
id
);
child
.
setAttribute
(
"
data-
"
+
_plugins
.
name
+
"
_id
"
,
id
);
});
});
this
.
items
.
set
(
id
,
newNode
)
;
this
.
items
[
id
]
=
newNode
;
_plugins
.
apply
(
newNode
);
_plugins
.
apply
(
newNode
);
return
newNode
;
return
newNode
;
}
}
...
@@ -310,8 +342,10 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -310,8 +342,10 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
if
(
_nb
!==
null
&&
_start
!==
null
)
{
if
(
_nb
!==
null
&&
_start
!==
null
)
{
// Loop through the existing items
// Loop through the existing items
this
.
items
.
loop
(
function
(
value
,
idx
)
{
Tools
.
loop
(
this
.
items
,
function
(
value
,
idx
)
{
// If an item is out of the boundary
// If an item is out of the boundary
idx
=
Number
(
idx
);
if
(
idx
<
_start
||
idx
>=
(
_start
+
_tmpNb
)
||
!
_model
.
has
(
idx
))
{
if
(
idx
<
_start
||
idx
>=
(
_start
+
_tmpNb
)
||
!
_model
.
has
(
idx
))
{
// Mark it
// Mark it
marked
.
push
(
idx
);
marked
.
push
(
idx
);
...
@@ -378,10 +412,7 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -378,10 +412,7 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
_model
.
watch
(
"
deleted
"
,
function
(
idx
)
{
_model
.
watch
(
"
deleted
"
,
function
(
idx
)
{
itemRenderer
.
render
();
itemRenderer
.
render
();
// Also remove all observers
// Also remove all observers
this
.
observers
[
idx
]
&&
this
.
observers
[
idx
].
forEach
(
function
(
handler
)
{
_removeObserversForId
(
idx
);
_model
.
unwatchValue
(
handler
);
},
this
);
delete
this
.
observers
[
idx
];
},
this
);
},
this
);
this
.
setItemRenderer
(
idItemRenderer
,
itemRenderer
);
this
.
setItemRenderer
(
idItemRenderer
,
itemRenderer
);
...
@@ -533,14 +564,14 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
...
@@ -533,14 +564,14 @@ function BindPlugin(Store, Observable, Tools, DomUtils) {
/**
/**
* Prevents the submit and set the model with all form's inputs
* Prevents the submit and set the model with all form's inputs
* @param {HTMLFormElement} for
m
* @param {HTMLFormElement} DOMfro
m
* @returns true if valid form
* @returns true if valid form
*/
*/
this
.
form
=
function
form
(
form
)
{
this
.
form
=
function
form
(
DOM
form
)
{
if
(
form
&&
form
.
nodeName
==
"
FORM
"
)
{
if
(
DOMform
&&
DOM
form
.
nodeName
==
"
FORM
"
)
{
var
that
=
this
;
var
that
=
this
;
form
.
addEventListener
(
"
submit
"
,
function
(
event
)
{
DOM
form
.
addEventListener
(
"
submit
"
,
function
(
event
)
{
Tools
.
toArray
(
form
.
querySelectorAll
(
"
[name]
"
)).
forEach
(
that
.
set
,
that
);
Tools
.
toArray
(
DOM
form
.
querySelectorAll
(
"
[name]
"
)).
forEach
(
that
.
set
,
that
);
event
.
preventDefault
();
event
.
preventDefault
();
},
true
);
},
true
);
return
true
;
return
true
;
...
...
examples/olives/bower_components/olives/src/DomUtils.js
View file @
9df98e41
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
define
([
"
Tools
"
],
function
(
Tools
)
{
define
([
"
Tools
"
],
function
(
Tools
)
{
"
use strict
"
;
return
{
return
{
/**
/**
* Returns a NodeList including the given dom node,
* Returns a NodeList including the given dom node,
...
...
examples/olives/bower_components/olives/src/Event.plugin.js
View file @
9df98e41
...
@@ -14,6 +14,8 @@ define(["DomUtils"],
...
@@ -14,6 +14,8 @@ define(["DomUtils"],
*/
*/
function
EventPlugin
(
Utils
)
{
function
EventPlugin
(
Utils
)
{
"
use strict
"
;
/**
/**
* The event plugin constructor.
* The event plugin constructor.
* ex: new EventPlugin({method: function(){} ...}, false);
* ex: new EventPlugin({method: function(){} ...}, false);
...
...
examples/olives/bower_components/olives/src/LocalStore.js
View file @
9df98e41
...
@@ -15,6 +15,8 @@ define(["Store", "Tools"],
...
@@ -15,6 +15,8 @@ define(["Store", "Tools"],
*/
*/
function
LocalStore
(
Store
,
Tools
)
{
function
LocalStore
(
Store
,
Tools
)
{
"
use strict
"
;
function
LocalStoreConstructor
()
{
function
LocalStoreConstructor
()
{
/**
/**
...
@@ -96,7 +98,7 @@ function LocalStore(Store, Tools) {
...
@@ -96,7 +98,7 @@ function LocalStore(Store, Tools) {
return
function
LocalStoreFactory
(
init
)
{
return
function
LocalStoreFactory
(
init
)
{
LocalStoreConstructor
.
prototype
=
new
Store
(
init
);
LocalStoreConstructor
.
prototype
=
new
Store
(
init
);
return
new
LocalStoreConstructor
;
return
new
LocalStoreConstructor
()
;
};
};
});
});
examples/olives/bower_components/olives/src/OObject.js
View file @
9df98e41
...
@@ -13,6 +13,8 @@ define(["StateMachine", "Store", "Plugins", "DomUtils", "Tools"],
...
@@ -13,6 +13,8 @@ define(["StateMachine", "Store", "Plugins", "DomUtils", "Tools"],
*/
*/
function
OObject
(
StateMachine
,
Store
,
Plugins
,
DomUtils
,
Tools
)
{
function
OObject
(
StateMachine
,
Store
,
Plugins
,
DomUtils
,
Tools
)
{
"
use strict
"
;
return
function
OObjectConstructor
(
otherStore
)
{
return
function
OObjectConstructor
(
otherStore
)
{
/**
/**
...
@@ -45,7 +47,7 @@ function OObject(StateMachine, Store, Plugins, DomUtils, Tools) {
...
@@ -45,7 +47,7 @@ function OObject(StateMachine, Store, Plugins, DomUtils, Tools) {
// as it wouldn't be possible to know which node would belong to which UI
// as it wouldn't be possible to know which node would belong to which UI
// This is probably a DOM limitation.
// This is probably a DOM limitation.
if
(
baseNode
.
childNodes
.
length
>
1
)
{
if
(
baseNode
.
childNodes
.
length
>
1
)
{
thro
w
Error
(
"
UI.template should have only one parent node
"
);
throw
ne
w
Error
(
"
UI.template should have only one parent node
"
);
}
else
{
}
else
{
UI
.
dom
=
baseNode
.
childNodes
[
0
];
UI
.
dom
=
baseNode
.
childNodes
[
0
];
}
}
...
@@ -54,7 +56,7 @@ function OObject(StateMachine, Store, Plugins, DomUtils, Tools) {
...
@@ -54,7 +56,7 @@ function OObject(StateMachine, Store, Plugins, DomUtils, Tools) {
}
else
{
}
else
{
// An explicit message I hope
// An explicit message I hope
thro
w
Error
(
"
UI.template must be set prior to render
"
);
throw
ne
w
Error
(
"
UI.template must be set prior to render
"
);
}
}
},
},
...
@@ -63,13 +65,17 @@ function OObject(StateMachine, Store, Plugins, DomUtils, Tools) {
...
@@ -63,13 +65,17 @@ function OObject(StateMachine, Store, Plugins, DomUtils, Tools) {
* This dom node should be somewhere in the dom of the application
* This dom node should be somewhere in the dom of the application
* @private
* @private
*/
*/
place
=
function
place
(
UI
,
place
,
beforeNode
)
{
place
=
function
place
(
UI
,
DOM
place
,
beforeNode
)
{
if
(
place
)
{
if
(
DOM
place
)
{
// IE (until 9) apparently fails to appendChild when insertBefore's second argument is null, hence this.
// IE (until 9) apparently fails to appendChild when insertBefore's second argument is null, hence this.
beforeNode
?
place
.
insertBefore
(
UI
.
dom
,
beforeNode
)
:
place
.
appendChild
(
UI
.
dom
);
if
(
beforeNode
)
{
DOMplace
.
insertBefore
(
UI
.
dom
,
beforeNode
);
}
else
{
DOMplace
.
appendChild
(
UI
.
dom
);
}
// Also save the new place, so next renderings
// Also save the new place, so next renderings
// will be made inside it
// will be made inside it
_currentPlace
=
place
;
_currentPlace
=
DOM
place
;
}
}
},
},
...
@@ -108,7 +114,7 @@ function OObject(StateMachine, Store, Plugins, DomUtils, Tools) {
...
@@ -108,7 +114,7 @@ function OObject(StateMachine, Store, Plugins, DomUtils, Tools) {
* It has set/get/del/has/watch/unwatch methods
* It has set/get/del/has/watch/unwatch methods
* @see Emily's doc for more info on how it works.
* @see Emily's doc for more info on how it works.
*/
*/
this
.
model
=
otherStore
instanceof
Store
?
otherStore
:
new
Store
;
this
.
model
=
otherStore
instanceof
Store
?
otherStore
:
new
Store
()
;
/**
/**
* The module that will manage the plugins for this UI
* The module that will manage the plugins for this UI
...
...
examples/olives/bower_components/olives/src/Place.plugin.js
View file @
9df98e41
...
@@ -12,6 +12,8 @@ define(["OObject", "Tools"],
...
@@ -12,6 +12,8 @@ define(["OObject", "Tools"],
*/
*/
function
PlacePlugin
(
OObject
,
Tools
)
{
function
PlacePlugin
(
OObject
,
Tools
)
{
"
use strict
"
;
/**
/**
* Intilialize a Place.plugin with a list of OObjects
* Intilialize a Place.plugin with a list of OObjects
* @param {Object} $uis a list of OObjects such as:
* @param {Object} $uis a list of OObjects such as:
...
...
examples/olives/bower_components/olives/src/Plugins.js
View file @
9df98e41
...
@@ -17,6 +17,8 @@ define(["Tools", "DomUtils"],
...
@@ -17,6 +17,8 @@ define(["Tools", "DomUtils"],
*/
*/
function
Plugins
(
Tools
,
DomUtils
)
{
function
Plugins
(
Tools
,
DomUtils
)
{
"
use strict
"
;
return
function
PluginsConstructor
(
$plugins
)
{
return
function
PluginsConstructor
(
$plugins
)
{
/**
/**
...
...
examples/olives/bower_components/olives/src/SocketIOTransport.js
View file @
9df98e41
...
@@ -12,6 +12,8 @@ define(["Observable", "Tools"],
...
@@ -12,6 +12,8 @@ define(["Observable", "Tools"],
*/
*/
function
SocketIOTransport
(
Observable
,
Tools
)
{
function
SocketIOTransport
(
Observable
,
Tools
)
{
"
use strict
"
;
/**
/**
* Defines the SocketIOTransport
* Defines the SocketIOTransport
* @private
* @private
...
@@ -47,7 +49,7 @@ function SocketIOTransport(Observable, Tools) {
...
@@ -47,7 +49,7 @@ function SocketIOTransport(Observable, Tools) {
*/
*/
this
.
getSocket
=
function
getSocket
()
{
this
.
getSocket
=
function
getSocket
()
{
return
_socket
;
return
_socket
;
}
,
}
;
/**
/**
* Subscribe to a socket event
* Subscribe to a socket event
...
@@ -56,7 +58,7 @@ function SocketIOTransport(Observable, Tools) {
...
@@ -56,7 +58,7 @@ function SocketIOTransport(Observable, Tools) {
*/
*/
this
.
on
=
function
on
(
event
,
func
)
{
this
.
on
=
function
on
(
event
,
func
)
{
return
_socket
.
on
(
event
,
func
);
return
_socket
.
on
(
event
,
func
);
}
,
}
;
/**
/**
* Subscribe to a socket event but disconnect as soon as it fires.
* Subscribe to a socket event but disconnect as soon as it fires.
...
@@ -95,15 +97,17 @@ function SocketIOTransport(Observable, Tools) {
...
@@ -95,15 +97,17 @@ function SocketIOTransport(Observable, Tools) {
* @param {Object} scope the scope in which to execute the callback
* @param {Object} scope the scope in which to execute the callback
*/
*/
this
.
request
=
function
request
(
channel
,
data
,
func
,
scope
)
{
this
.
request
=
function
request
(
channel
,
data
,
func
,
scope
)
{
if
(
typeof
channel
==
"
string
"
if
(
typeof
channel
==
"
string
"
&&
&&
typeof
data
!=
"
undefined
"
)
{
typeof
data
!=
"
undefined
"
)
{
var
reqData
=
{
var
reqData
=
{
eventId
:
Date
.
now
()
+
Math
.
floor
(
Math
.
random
()
*
1
e6
),
eventId
:
Date
.
now
()
+
Math
.
floor
(
Math
.
random
()
*
1
e6
),
data
:
data
data
:
data
},
},
boundCallback
=
function
()
{
boundCallback
=
function
()
{
func
&&
func
.
apply
(
scope
||
null
,
arguments
);
if
(
func
)
{
func
.
apply
(
scope
||
null
,
arguments
);
}
};
};
this
.
once
(
reqData
.
eventId
,
boundCallback
);
this
.
once
(
reqData
.
eventId
,
boundCallback
);
...
@@ -125,9 +129,9 @@ function SocketIOTransport(Observable, Tools) {
...
@@ -125,9 +129,9 @@ function SocketIOTransport(Observable, Tools) {
* @returns
* @returns
*/
*/
this
.
listen
=
function
listen
(
channel
,
data
,
func
,
scope
)
{
this
.
listen
=
function
listen
(
channel
,
data
,
func
,
scope
)
{
if
(
typeof
channel
==
"
string
"
if
(
typeof
channel
==
"
string
"
&&
&&
typeof
data
!=
"
undefined
"
typeof
data
!=
"
undefined
"
&&
&&
typeof
func
==
"
function
"
)
{
typeof
func
==
"
function
"
)
{
var
reqData
=
{
var
reqData
=
{
eventId
:
Date
.
now
()
+
Math
.
floor
(
Math
.
random
()
*
1
e6
),
eventId
:
Date
.
now
()
+
Math
.
floor
(
Math
.
random
()
*
1
e6
),
...
@@ -135,7 +139,9 @@ function SocketIOTransport(Observable, Tools) {
...
@@ -135,7 +139,9 @@ function SocketIOTransport(Observable, Tools) {
keepAlive
:
true
keepAlive
:
true
},
},
boundCallback
=
function
()
{
boundCallback
=
function
()
{
func
&&
func
.
apply
(
scope
||
null
,
arguments
);
if
(
func
)
{
func
.
apply
(
scope
||
null
,
arguments
);
}
},
},
that
=
this
;
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