Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nghyd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
Cassiopée
nghyd
Commits
f67b8789
Commit
f67b8789
authored
7 years ago
by
francois.grand
Browse files
Options
Downloads
Patches
Plain Diff
classe Observable : suppression du setter sender()
parent
4565423c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Resolve "Ajout de la calculette "Ouvrages hydrauliques""
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/formulaire/ngparam.ts
+1
-2
1 addition, 2 deletions
src/app/formulaire/ngparam.ts
src/app/services/observer.ts
+5
-10
5 additions, 10 deletions
src/app/services/observer.ts
with
6 additions
and
12 deletions
src/app/formulaire/ngparam.ts
+
1
−
2
View file @
f67b8789
...
...
@@ -81,7 +81,6 @@ export class NgParameter extends InputField implements IObservable {
constructor
(
private
_paramDef
:
ParamDefinition
,
formId
:
number
)
{
super
(
_paramDef
.
computeNodeType
,
_paramDef
.
symbol
,
formId
);
this
.
_observable
=
new
Observable
();
this
.
_observable
.
sender
=
this
;
}
get
symbol
():
string
{
...
...
@@ -305,6 +304,6 @@ export class NgParameter extends InputField implements IObservable {
* notifie un événement aux observateurs
*/
public
notifyObservers
(
data
:
any
)
{
this
.
_observable
.
notifyObservers
(
data
);
this
.
_observable
.
notifyObservers
(
data
,
this
);
}
}
This diff is collapsed.
Click to expand it.
src/app/services/observer.ts
+
5
−
10
View file @
f67b8789
...
...
@@ -16,21 +16,14 @@ export interface IObservable {
/**
* notifie un événement aux observateurs
*/
notifyObservers
(
data
:
any
);
notifyObservers
(
data
:
any
,
sender
?:
any
);
}
export
class
Observable
implements
IObservable
{
private
_observers
:
Observer
[];
private
_sender
:
IObservable
;
constructor
()
{
this
.
_observers
=
[];
this
.
_sender
=
this
;
}
public
set
sender
(
s
:
IObservable
)
{
this
.
_sender
=
s
;
}
/**
...
...
@@ -51,8 +44,10 @@ export class Observable implements IObservable {
/**
* notifie un événement aux observateurs
*/
public
notifyObservers
(
data
:
any
)
{
public
notifyObservers
(
data
:
any
,
sender
?:
any
)
{
if
(
sender
==
undefined
)
sender
=
this
;
for
(
let
o
of
this
.
_observers
)
o
.
update
(
this
.
_
sender
,
data
);
o
.
update
(
sender
,
data
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment