Skip to content

Instantly share code, notes, and snippets.

@kellyjandrews
Last active June 30, 2020 04:58
Show Gist options
  • Save kellyjandrews/53c4772dc742ce1b84c40e3fa6669c6e to your computer and use it in GitHub Desktop.
Save kellyjandrews/53c4772dc742ce1b84c40e3fa6669c6e to your computer and use it in GitHub Desktop.

Revisions

  1. kellyjandrews revised this gist Jun 30, 2020. No changes.
  2. kellyjandrews revised this gist Jun 30, 2020. 1 changed file with 0 additions and 16 deletions.
    16 changes: 0 additions & 16 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -41,22 +41,6 @@ const video = Machine({
    },
    'publisher': {
    id: 'publisher',
    },
    'screenShare': {
    id: 'screenShare',
    initial: 'idle',
    states: {
    'idle': {
    on: {
    'SHARE': 'active'
    }
    },
    'active': {
    on: {
    'STOP_SHARE': 'idle'
    }
    }
    }
    }
    },
    on: {
  3. kellyjandrews revised this gist Jun 30, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion machine.js
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ const video = Machine({
    'init': {
    id: 'init',
    on: {
    'READY': {
    'VIDEO_ELEMENT_CREATED': {
    target: 'ready',
    cond: 'checkToken'
    }
  4. kellyjandrews revised this gist Jun 30, 2020. No changes.
  5. kellyjandrews revised this gist Jun 30, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion machine.js
    Original file line number Diff line number Diff line change
    @@ -66,6 +66,6 @@ const video = Machine({
    }
    },{
    guards: {
    checkToken: true
    checkToken: () => true
    }
    });
  6. kellyjandrews revised this gist Jun 30, 2020. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion machine.js
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ const video = Machine({
    on: {
    'READY': {
    target: 'ready',
    cond: 'true'
    cond: 'checkToken'
    }
    }
    },
    @@ -64,4 +64,8 @@ const video = Machine({
    }
    }
    }
    },{
    guards: {
    checkToken: true
    }
    });
  7. kellyjandrews revised this gist Jun 30, 2020. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion machine.js
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,10 @@ const video = Machine({
    'init': {
    id: 'init',
    on: {
    'READY': 'ready'
    'READY': {
    target: 'ready',
    cond: 'true'
    }
    }
    },
    'ready': {
  8. kellyjandrews revised this gist Jun 30, 2020. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion machine.js
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,16 @@ const video = Machine({
    id: 'screenShare',
    initial: 'idle',
    states: {
    'idle': {}
    'idle': {
    on: {
    'SHARE': 'active'
    }
    },
    'active': {
    on: {
    'STOP_SHARE': 'idle'
    }
    }
    }
    }
    },
  9. kellyjandrews revised this gist Jun 29, 2020. 1 changed file with 0 additions and 7 deletions.
    7 changes: 0 additions & 7 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,6 @@
    const video = Machine({
    id: 'video',
    initial: 'disconnected',
    context: {
    session: null,
    token: null,
    publisher: null,
    subscribers: null,
    screenShare: null
    },
    states: {
    disconnected: {
    id: 'disconnected',
  10. kellyjandrews revised this gist Jun 29, 2020. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -59,7 +59,4 @@ const video = Machine({
    }
    }
    }
    }, {
    actions: {},
    services: {}
    });
  11. kellyjandrews revised this gist Jun 29, 2020. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion machine.js
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,6 @@ const video = Machine({
    },
    'init': {
    id: 'init',

    on: {
    'READY': 'ready'
    }
  12. kellyjandrews revised this gist Jun 29, 2020. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,13 @@
    const video = Machine({
    id: 'video',
    initial: 'disconnected',
    context: {
    session: null,
    token: null,
    publisher: null,
    subscribers: null,
    screenShare: null
    },
    states: {
    disconnected: {
    id: 'disconnected',
    @@ -14,6 +21,7 @@ const video = Machine({
    },
    'init': {
    id: 'init',

    on: {
    'READY': 'ready'
    }
    @@ -52,4 +60,7 @@ const video = Machine({
    }
    }
    }
    }, {
    actions: {},
    services: {}
    });
  13. kellyjandrews revised this gist Jun 29, 2020. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -46,6 +46,9 @@ const video = Machine({
    'idle': {}
    }
    }
    },
    on: {
    'DISCONNECT': '#disconnected'
    }
    }
    }
  14. kellyjandrews revised this gist Jun 29, 2020. 1 changed file with 16 additions and 3 deletions.
    19 changes: 16 additions & 3 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -30,9 +30,22 @@ const video = Machine({
    id: 'connected',
    type: 'parallel',
    states: {
    'subscribers': {},
    'publisher': {},
    'screenShare': {}
    'session': {
    id: 'session',
    },
    'subscriber': {
    id: 'subscriber',
    },
    'publisher': {
    id: 'publisher',
    },
    'screenShare': {
    id: 'screenShare',
    initial: 'idle',
    states: {
    'idle': {}
    }
    }
    }
    }
    }
  15. kellyjandrews revised this gist Jun 29, 2020. 1 changed file with 22 additions and 5 deletions.
    27 changes: 22 additions & 5 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -6,16 +6,33 @@ const video = Machine({
    id: 'disconnected',
    initial: 'idle',
    states: {
    'idle': {},
    'init': {},
    'ready': {}
    'idle': {
    id: 'idle',
    on: {
    'START': 'init'
    }
    },
    'init': {
    id: 'init',
    on: {
    'READY': 'ready'
    }
    },
    'ready': {
    id: 'ready',
    on: {
    'CONNECT': '#connected'
    }
    }
    }
    },
    connected: {
    id: 'connected',
    type: 'parallel',
    states: {
    'published': {},
    'sharing': {}
    'subscribers': {},
    'publisher': {},
    'screenShare': {}
    }
    }
    }
  16. kellyjandrews created this gist Jun 29, 2020.
    22 changes: 22 additions & 0 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    const video = Machine({
    id: 'video',
    initial: 'disconnected',
    states: {
    disconnected: {
    id: 'disconnected',
    initial: 'idle',
    states: {
    'idle': {},
    'init': {},
    'ready': {}
    }
    },
    connected: {
    type: 'parallel',
    states: {
    'published': {},
    'sharing': {}
    }
    }
    }
    });