forked from microsoft/PhETOfficeAddIn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabs-1.0.4.d.ts
2165 lines (2150 loc) · 73.9 KB
/
labs-1.0.4.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*!
* Labs.js JavaScript API for Office Mix
* Version: 1.0.4 * Copyright (c) Microsoft Corporation. All rights reserved.
* Your use of this file is governed by the Microsoft Services Agreement http://go.microsoft.com/fwlink/?LinkId=266419.
*/
declare module Labs.Core {
/**
* Definition of a lab action. An action represents an interaction a user has taken with the lab.
*/
interface IAction {
/**
* The type of action taken.
*/
type: string;
/**
* The options sent with the action
*/
options: Core.IActionOptions;
/**
* The result of the action
*/
result: Core.IActionResult;
/**
* The time at which the action was completed. In milliseconds elapsed since 1 January 1970 00:00:00 UTC.
*/
time: number;
}
}
declare module Labs.Core {
/**
* The results of taking an action. Depending on the type of action these will either be set by the server side
* or provided by the client when taking the action.
*/
interface IActionResult {
}
}
declare module Labs.Core {
/**
* Base class for instances of a lab component. An instance is an instantiation of a component for a user. It contains
* a translated view of the component for a particular run of the lab. This view may exclude hidden information (answers, hints, etc...)
* and also contains IDs to identify the various instances.
*/
interface IComponentInstance extends Core.ILabObject, Core.IUserData {
/**
* The ID of the component this instance is associated with
*/
componentId: string;
/**
* The name of the component
*/
name: string;
/**
* value property map associated with the component
*/
values: {
[type: string]: Core.IValueInstance[];
};
}
}
declare module Labs.Core {
/**
* Information about the lab configuration.
*/
interface IConfigurationInfo {
/**
* The version of the host the lab configuration was created with.
*/
hostVersion: Core.IVersion;
}
}
declare module Labs.Core {
/**
* Response information coming from a connection call
*/
interface IConnectionResponse {
/**
* Initialization information or null if the app has not yet been initialized
*/
initializationInfo: Core.IConfigurationInfo;
/**
* The current mode the lab is running in
*/
mode: Core.LabMode;
/**
* Version information for server side
*/
hostVersion: Core.IVersion;
/**
* Information about the user
*/
userInfo: Core.IUserInfo;
}
}
declare module Labs.Core {
/**
* Options passed as part of a get action
*/
interface IGetActionOptions {
}
}
declare module Labs.Core {
/**
* Options passed as part of a lab create.
*/
interface ILabCreationOptions {
}
}
declare module Labs.Core {
/**
* Version information about the lab host
*/
interface ILabHostVersionInfo {
/**
* The API version of the host
*/
version: Core.IVersion;
}
}
declare module Labs.Core {
/**
* Definition of lab action options. These are the options passed when performing a given action.
*/
interface IActionOptions {
}
}
declare module Labs.Core {
/**
* Base interface for messages sent between the client and the host.
*/
interface IMessage {
}
}
declare module Labs.Core {
/**
* Base interface for responses to messages sent to the host.
*/
interface IMessageResponse {
}
}
declare module Labs.Core {
/**
* User information
*/
interface IUserInfo {
/**
* Unique identifier for the given lab user
*/
id: string;
/**
* Permissions the user has access to
*/
permissions: string[];
}
}
declare module Labs.Core {
/**
* An intance of an IValue
*/
interface IValueInstance {
/**
* ID for the value this instance represents
*/
valueId: string;
/**
* Flag indicating whether or not this value is considered a hint
*/
isHint: boolean;
/**
* Flag indicating whether or not the instance information contains the value.
*/
hasValue: boolean;
/**
* The value. May or may not be set depending on if it has been hidden.
*/
value?: any;
}
}
declare module Labs.Core {
/**
* Version information
*/
interface IVersion {
/**
* Major version
*/
major: number;
/**
* Minor version
*/
minor: number;
}
}
declare module Labs.Core {
/**
* Custom analytics configuration information. Allows the develper to specify which iframe to load
* in order to display custom analytics for a user's run of a lab.
*/
interface IAnalyticsConfiguration {
}
}
declare module Labs.Core {
/**
* Completion status for the lab. Passed when completing the lab to indicate the result of the interaction.
*/
interface ICompletionStatus {
}
}
declare module Labs.Core {
/**
* Interface for Labs.js callback methods
*/
interface ILabCallback<T> {
/**
* Callback signature
*
* @param { err } If an error has occurred this will be non-null
* @param { data } The data returned with the callback
*/
(err: any, data: T): void;
}
}
declare module Labs.Core {
/**
* A lab object contains a type field which indicates what type of object it is
*/
interface ILabObject {
/**
* The type name for the object
*/
type: string;
}
}
declare module Labs.Core {
/**
* Timeline configuration options. Allows the lab developer to specify a set of timeline configuration options.
*/
interface ITimelineConfiguration {
/**
* The duration of the lab in seconds
*/
duration: number;
/**
* A list of timeline capabilities the lab supports. i.e. play, pause, seek, fast forward...
*/
capabilities: string[];
}
}
declare module Labs.Core {
/**
* Base interface to represent custom user data stored on an object
*/
interface IUserData {
/**
* An optional data field stored on the object for custom fields.
*/
data?: any;
}
}
declare module Labs.Core {
/**
* Base class for values stored with a lab
*/
interface IValue {
/**
* Flag indicating whether or not this value is considered a hint
*/
isHint: boolean;
/**
* The value
*/
value: any;
}
}
declare module Labs.Core {
/**
* Lab configuration data structure
*/
interface IConfiguration extends Core.IUserData {
/**
* The version of the application associated with this configuration
*/
appVersion: Core.IVersion;
/**
* The components of the lab
*/
components: Core.IComponent[];
/**
* The name of the lab
*/
name: string;
/**
* Lab timeline configuration
*/
timeline: Core.ITimelineConfiguration;
/**
* Lab analytics configuration
*/
analytics: Core.IAnalyticsConfiguration;
}
}
declare module Labs.Core {
/**
* Base class for instances of a lab configuration. An instance is an instantiation of a configuration for a user. It contains
* a translated view of the configuration for a particular run of the lab. This view may exclude hidden information (answers, hints, etc...)
* and also contains IDs to identify the various instances.
*/
interface IConfigurationInstance extends Core.IUserData {
/**
* The version of the application associated with this configuration
*/
appVersion: Core.IVersion;
/**
* The components of the lab
*/
components: Core.IComponentInstance[];
/**
* The name of the lab
*/
name: string;
/**
* Lab timeline configuration
*/
timeline: Core.ITimelineConfiguration;
}
}
declare module Labs.Core {
/**
* Base class for components of a lab.
*/
interface IComponent extends Core.ILabObject, Core.IUserData {
/**
* The name of the component
*/
name: string;
/**
* value property map associated with the component
*/
values: {
[type: string]: Core.IValue[];
};
}
}
declare module Labs.Core {
/**
* The current mode of the lab. Whether in edit mode or view mode. Edit is when configuring the lab and view
* is when taking the lab.
*/
enum LabMode {
/**
* The lab is in edit mode. Meaning the user is configuring it
*/
Edit,
/**
* The lab is in view mode. Meaning the user is taking it
*/
View,
}
}
declare module Labs.Core {
/**
* The ILabHost interfaces provides an abstraction for connecting Labs.js to the host
*/
interface ILabHost {
/**
* Retrieves the versions supported by this lab host.
*/
getSupportedVersions(): Core.ILabHostVersionInfo[];
/**
* Initializes communication with the host
*
* @param { versions } The list of versions that the client of the host can make use of
* @param { callback } Callback for when the connection is complete
*/
connect(versions: Core.ILabHostVersionInfo[], callback: Core.ILabCallback<Core.IConnectionResponse>);
/**
* Stops communication with the host
*
* @param { completionStatus } The final status of the lab at the time of the disconnect
* @param { callback } Callback fired when the disconnect completes
*/
disconnect(callback: Core.ILabCallback<void>);
/**
* Adds an event handler for dealing with messages coming from the host. The resolved promsie
* will be returned back to the host
*
* @param { handler } The event handler
*/
on(handler: (string: any, any: any) => void);
/**
* Sends a message to the host
*
* @param { type } The type of message being sent
* @param { options } The options for that message
* @param { callback } Callback invoked once the message has been received
*/
sendMessage(type: string, options: Core.IMessage, callback: Core.ILabCallback<Core.IMessageResponse>);
/**
* Creates the lab. Stores the host information and sets aside space for storing the configuration and other elements.
*
* @param { options } Options passed as part of creation
*/
create(options: Core.ILabCreationOptions, callback: Core.ILabCallback<void>);
/**
* Gets the current lab configuration from the host
*
* @param { callback } Callback method for retrieving configuration information
*/
getConfiguration(callback: Core.ILabCallback<Core.IConfiguration>);
/**
* Sets a new lab configuration on the host
*
* @param { configuration } The lab configuration to set
* @param { callback } Callback fired when the configuration is set
*/
setConfiguration(configuration: Core.IConfiguration, callback: Core.ILabCallback<void>);
/**
* Retrieves the instance configuration for the lab
*
* @param { callback } Callback that will be called when the configuration instance is retrieved
*/
getConfigurationInstance(callback: Core.ILabCallback<Core.IConfigurationInstance>);
/**
* Gets the current state of the lab for the user
*
* @param { completionStatus } Callback that will return the current lab state
*/
getState(callback: Core.ILabCallback<any>);
/**
* Sets the state of the lab for the user
*
* @param { state } The lab state
* @param { callback } Callback that will be invoked when the state has been set
*/
setState(state: any, callback: Core.ILabCallback<void>);
/**
* Takes an attempt action
*
* @param { type } The type of action
* @param { options } The options provided with the action
* @param { callback } Callback which returns the final executed action
*/
takeAction(type: string, options: Core.IActionOptions, callback: Core.ILabCallback<Core.IAction>);
/**
* Takes an action that has already been completed
*
* @param { type } The type of action
* @param { options } The options provided with the action
* @param { result } The result of the action
* @param { callback } Callback which returns the final executed action
*/
takeAction(type: string, options: Core.IActionOptions, result: Core.IActionResult, callback: Core.ILabCallback<Core.IAction>);
/**
* Retrieves the actions for a given attempt
*
* @param { type } The type of get action
* @param { options } The options provided with the get action
* @param { callback } Callback which returns the list of completed actions
*/
getActions(type: string, options: Core.IGetActionOptions, callback: Core.ILabCallback<Core.IAction[]>);
}
}
declare module Labs.Core {
/**
* Static class representing the permissions allowed for the given user of the lab
*/
class Permissions {
/**
* Ability to edit the lab
*/
static Edit: string;
/**
* Ability to take the lab
*/
static Take: string;
}
}
declare module Labs.Core.Actions {
/**
* Closes the component and indicates there will be no future actions against it.
*/
var CloseComponentAction: string;
/**
* Closes a component and indicates there will be no more actions against it.
*/
interface ICloseComponentOptions extends Core.IActionOptions {
/**
* The component to close.
*/
componentId: string;
}
}
declare module Labs.Core.Actions {
/**
* Action to create a new attempt
*/
var CreateAttemptAction: string;
/**
* Creates a new attempt for the given component.
*/
interface ICreateAttemptOptions extends Core.IActionOptions {
/**
* The component the attempt is associated with
*/
componentId: string;
}
}
declare module Labs.Core.Actions {
/**
* The result of creating an attempt for the given component.
*/
interface ICreateAttemptResult extends Core.IActionResult {
/**
* The ID of the created attempt
*/
attemptId: string;
}
}
declare module Labs.Core.Actions {
/**
* Action to create a new component
*/
var CreateComponentAction: string;
/**
* Creates a new component
*/
interface ICreateComponentOptions extends Core.IActionOptions {
/**
* The component invoking the create component action.
*/
componentId: string;
/**
* The component to create
*/
component: Core.IComponent;
/**
* An (optional) field used to correlate this component across all instances of a lab.
* Allows the hosting system to identify different attempts at the same component.
*/
correlationId?: string;
}
}
declare module Labs.Core.Actions {
/**
* The result of creating a new component.
*/
interface ICreateComponentResult extends Core.IActionResult {
/**
* The created component instance
*/
componentInstance: Core.IComponentInstance;
}
}
declare module Labs.Core.Actions {
/**
* The result of a get value action
*/
interface IGetValueResult extends Core.IActionResult {
/**
* The retrieved value
*/
value: any;
}
}
declare module Labs.Core.Actions {
/**
* The result of submitting an answer for an attempt
*/
interface ISubmitAnswerResult extends Core.IActionResult {
/**
* An ID associated with the submission. Will be filled in by the server.
*/
submissionId: string;
/**
* Whether the attempt is complete due to this submission
*/
complete: boolean;
/**
* Scoring information associated with the submission
*/
score: any;
}
}
declare module Labs.Core.Actions {
/**
* Attempt timeout action
*/
var AttemptTimeoutAction: string;
/**
* Options for the attempt timeout action
*/
interface IAttemptTimeoutOptions extends Core.IActionOptions {
/**
* The ID of the attempt that timed out
*/
attemptId: string;
}
}
declare module Labs.Core.Actions {
/**
* Action to retrieve a value associated with an attempt.
*/
var GetValueAction: string;
interface IGetValueOptions extends Core.IActionOptions {
/**
* The component the get value is associated with
*/
componentId: string;
/**
* The attempt to get the value for
*/
attemptId: string;
/**
* The ID of the value to receive
*/
valueId: string;
}
}
declare module Labs.Core.Actions {
/**
* Resume attempt action. Used to indicate the user is resuming work on a given attempt.
*/
var ResumeAttemptAction: string;
/**
* Options associated with a resume attempt
*/
interface IResumeAttemptOptions extends Core.IActionOptions {
/**
* The component the attempt is associated with
*/
componentId: string;
/**
* The attempt that is being resumed
*/
attemptId: string;
}
}
declare module Labs.Core.Actions {
/**
* Action to submit an answer for a given attempt
*/
var SubmitAnswerAction: string;
/**
* Options for the submit answer action
*/
interface ISubmitAnswerOptions extends Core.IActionOptions {
/**
* The component the submission is associated with
*/
componentId: string;
/**
* The attempt the submission is associated with
*/
attemptId: string;
/**
* The answer being submitted
*/
answer: any;
}
}
declare module Labs.Core.GetActions {
/**
* Gets actions associated with a given component.
*/
var GetComponentActions: string;
/**
* Options associated with a get component actions
*/
interface IGetComponentActionsOptions extends Core.IGetActionOptions {
/**
* The component being searched for
*/
componentId: string;
/**
* The type of action being searched for
*/
action: string;
}
}
declare module Labs.Core.GetActions {
/**
* Get attempt get action. Retrieves all actions associated with a given attempt.
*/
var GetAttempt: string;
/**
* Options associated with a get attempt get action.
*/
interface IGetAttemptOptions extends Core.IGetActionOptions {
/**
* The attempt ID to retrieve all the actions for
*/
attemptId: string;
}
}
declare module Labs.Core {
/**
* Interface for EventManager callbacks
*/
interface IEventCallback {
(data: any): void;
}
}
declare module Labs {
var TimelineNextMessageType: string;
interface ITimelineNextMessage extends Labs.Core.IMessage {
status: Labs.Core.ICompletionStatus;
}
}
declare module Labs {
/**
* Base class for components instances
*/
class ComponentInstanceBase {
/**
* The ID of the component
*/
public _id: string;
/**
* The LabsInternal object for use by the component instance
*/
public _labs: Labs.LabsInternal;
constructor();
/**
* Attaches a LabsInternal to this component instance
*
* @param { id } The ID of the component
* @param { labs } The LabsInternal object for use by the instance
*/
public attach(id: string, labs: Labs.LabsInternal): void;
}
}
declare module Labs {
/**
* Class representing a component instance. An instance is an instantiation of a component for a user. It contains
* a translated view of the component for a particular run of the lab.
*/
class ComponentInstance<T> extends Labs.ComponentInstanceBase {
/**
* Constructs a new ComponentInstance.
*/
constructor();
/**
* Begins a new attempt at the component
*
* @param { callback } Callback fired when the attempt has been created
*/
public createAttempt(callback: Labs.Core.ILabCallback<T>): void;
/**
* Retrieves all attempts associated with the given component
*
* @param { callback } Callback fired once the attempts have been retrieved
*/
public getAttempts(callback: Labs.Core.ILabCallback<T[]>): void;
/**
* Retrieves the default create attempt options. Can be overriden by derived classes.
*/
public getCreateAttemptOptions(): Labs.Core.Actions.ICreateAttemptOptions;
/**
* method to built an attempt from the given action. Should be implemented by derived classes.
*
* @param { createAttemptResult } The create attempt action for the attempt
*/
public buildAttempt(createAttemptResult: Labs.Core.IAction): T;
}
}
declare module Labs {
/**
* Enumeration of the connection states
*/
enum ConnectionState {
/**
* Disconnected
*/
Disconnected,
/**
* In the process of connecting
*/
Connecting,
/**
* Connected
*/
Connected,
}
}
declare module Labs {
/**
* Helper class to manage a set of event handlers
*/
class EventManager {
private _handlers;
private getHandler(event);
/**
* Adds a new event handler for the given event
*
* @param { event } The event to add a handler for
* @param { handler } The event handler to add
*/
public add(event: string, handler: Labs.Core.IEventCallback): void;
/**
* Removes an event handler for the given event
*
* @param { event } The event to remove a handler for
* @param { handler } The event handler to remove
*/
public remove(event: string, handler: Labs.Core.IEventCallback): void;
/**
* Fires the given event
*
* @param { event } The event to fire
* @param { data } Data associated with the event
*/
public fire(event: string, data: any): void;
}
}
declare module Labs {
/**
* The LabEditor allows for the editing of the given lab. This includes getting and setting
* the entire configuration associated with the lab.
*/
class LabEditor {
private _labsInternal;
private _doneCallback;
/**
* Constructs a new LabEditor
*
* @param { labsInternal } LabsInternal to use with the editor
* @param { doneCallback } Callback to invoke when the editor is finished
*/
constructor(labsInternal: Labs.LabsInternal, doneCallback: Function);
/**
* Creates a new lab. This prepares the lab storage and saves the host version
*
* @param { labsInternal } LabsInternal to use with the editor
* @param { doneCallback } Callback to invoke when the editor is finished
* @param { callback } Callback fired once the LabEditor has been created
*/
static Create(labsInternal: Labs.LabsInternal, doneCallback: Function, callback: Labs.Core.ILabCallback<LabEditor>): void;
/**
* Gets the current lab configuration
*
* @param { callback } Callback fired once the configuration has been retrieved
*/
public getConfiguration(callback: Labs.Core.ILabCallback<Labs.Core.IConfiguration>): void;
/**
* Sets a new lab configuration
*
* @param { configuration } The configuration to set
* @param { callback } Callback fired once the configuration has been set
*/
public setConfiguration(configuration: Labs.Core.IConfiguration, callback: Labs.Core.ILabCallback<void>): void;
/**
* Indicates that the user is done editing the lab.
*
* @param { callback } Callback fired once the lab editor has finished
*/
public done(callback: Labs.Core.ILabCallback<void>): void;
}
}
declare module Labs {
/**
* A LabInstance is an instance of the configured lab for the current user. It is used to
* record and retrieve per user lab data.
*/
class LabInstance {
private _labsInternal;
private _doneCallback;
public data: any;
/**
* The components that make up the lab instance
*/
public components: Labs.ComponentInstanceBase[];
/**
* Constructs a new LabInstance
*
* @param { labsInternal } The LabsInternal to use with the instance
* @param { components } The components of the lab instance
* @param { doneCallback } Callback to invoke once the user is done taking the instance
* @param { data } Custom data attached to the lab
*/
constructor(labsInternal: Labs.LabsInternal, components: Labs.ComponentInstanceBase[], doneCallback: Function, data: any);
/**
* Creates a new LabInstance
*
* @param { labsInternal } The LabsInternal to use with the instance
* @param { doneCallback } Callback to invoke once the user is done taking the instance
* @param { callback } Callback that fires once the LabInstance has been created
*/
static Create(labsInternal: Labs.LabsInternal, doneCallback: Function, callback: Labs.Core.ILabCallback<LabInstance>): void;
/**
* Gets the current state of the lab for the user
*
* @param { callback } Callback that fires with the lab state
*/
public getState(callback: Labs.Core.ILabCallback<any>): void;
/**
* Sets the state of the lab for the user
*
* @param { state } The state to set
* @param { callback } Callback that fires once the state is set
*/
public setState(state: any, callback: Labs.Core.ILabCallback<void>): void;
/**
* Indicates that the user is done taking the lab.
*
* @param { callback } Callback fired once the lab instance has finished
*/
public done(callback: Labs.Core.ILabCallback<void>): void;
}
}
declare module Labs {
/**
* Method to use to construct a default ILabHost
*/
var DefaultHostBuilder: () => Core.ILabHost;
/**
* Initializes a connection with the host.
*
* @param { labHost } The (optional) ILabHost to use. If not specified will be constructed with the DefaultHostBuilder
* @param { callback } Callback to fire once the connection has been established
*/
function connect(callback: Core.ILabCallback<Core.IConnectionResponse>);
function connect(labHost: Core.ILabHost, callback: Core.ILabCallback<Core.IConnectionResponse>);
/**
* Returns whether or not the labs are connected to the host.
*/
function isConnected(): boolean;
/**
* Retrieves the information associated with a connection
*/
function getConnectionInfo(): Core.IConnectionResponse;
/**
* Disconnects from the host.
*
* @param { completionStatus } The final result of the lab interaction
*/
function disconnect(): void;
/**
* Opens the lab for editing. When in edit mode the configuration can be specified. A lab cannot be edited while it
* is being taken.
*
* @param { callback } Callback fired once the LabEditor is created
*/
function editLab(callback: Core.ILabCallback<LabEditor>): void;
/**
* Takes the given lab. This allows results to be sent for the lab. A lab cannot be taken while it is being edited.
*
* @param { callback } Callback fired once the LabInstance is created
*/
function takeLab(callback: Core.ILabCallback<LabInstance>): void;
/**
* Adds a new event handler for the given event
*
* @param { event } The event to add a handler for
* @param { handler } The event handler to add
*/
function on(event: string, handler: Core.IEventCallback): void;
/**
* Removes an event handler for the given event
*
* @param { event } The event to remove a handler for
* @param { handler } The event handler to remove
*/
function off(event: string, handler: Core.IEventCallback): void;
/**
* Retrieves the Timeline object that can be used to control the host's player control.
*/
function getTimeline(): Timeline;
/**
* Registers a function to deserialize the given type. Should be used by component authors only.
*
* @param { type } The type to deserialize
* @param { deserialize } The deserialization function
*/
function registerDeserializer(type: string, deserialize: (json: Core.ILabObject) => any): void;
/**
* Deserializes the given json object into an object. Should be used by component authors only.
*
* @param { json } The ILabObject to deserialize
*/
function deserialize(json: Core.ILabObject): any;
}
declare module Labs {
/**
* Class used to interface with the underlying ILabsHost interface.
*/
class LabsInternal {
/**
* Current state of the LabsInternal
*/
private _state;
/**
* The driver to send our commands to
*/