-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(global-connect): use rules for canStartConnection
* remove `GlobalConnect#registerProvider` * use `connection.start` rule to determine whether an element can start a connection Closes #565 BREAKING CHANGE: * `GlobalConnect#registerProvider` got removed. Create a rule for `connection.start` instead.
- Loading branch information
1 parent
be16460
commit 1efb277
Showing
4 changed files
with
74 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
test/spec/features/global-connect/rules/GlobalConnectRules.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import inherits from 'inherits'; | ||
|
||
import RuleProvider from 'lib/features/rules/RuleProvider'; | ||
|
||
export default function GlobalConnectRules(eventBus) { | ||
RuleProvider.call(this, eventBus); | ||
} | ||
|
||
GlobalConnectRules.$inject = ['eventBus']; | ||
|
||
inherits(GlobalConnectRules, RuleProvider); | ||
|
||
GlobalConnectRules.prototype.init = function() { | ||
|
||
this.addRule('connection.start', function(context) { | ||
var source = context.source; | ||
|
||
if (source.canStartConnection) { | ||
return true; | ||
} | ||
|
||
return false; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import GlobalConnectRules from './GlobalConnectRules'; | ||
|
||
export default { | ||
__init__: [ 'globalConnectRules' ], | ||
globalConnectRules: [ 'type', GlobalConnectRules ] | ||
}; |