File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -53,18 +53,19 @@ export class Navigation extends TypedEventTarget<{ updateActive: UpdateActiveVie
5353 /**
5454 * Register a new view on the navigation
5555 *
56- * @param view The view to register
56+ * @param views The views to register
5757 * @throws {Error } if a view with the same id is already registered
5858 * @throws {Error } if the registered view is invalid
5959 */
60- register ( view : IView ) : void {
61- if ( this . _views . find ( ( search ) => search . id === view . id ) ) {
62- throw new Error ( `IView id ${ view . id } is already registered` )
60+ register ( ...views : IView [ ] ) : void {
61+ for ( const view of views ) {
62+ if ( this . _views . find ( ( search ) => search . id === view . id ) ) {
63+ throw new Error ( `IView id ${ view . id } is already registered` )
64+ }
65+ validateView ( view )
6366 }
6467
65- validateView ( view )
66-
67- this . _views . push ( view )
68+ this . _views . push ( ...views )
6869 this . dispatchTypedEvent ( 'update' , new CustomEvent < never > ( 'update' ) as UpdateViewsEvent )
6970 }
7071
You can’t perform that action at this time.
0 commit comments