Skip to content

invalid import statement in Example #250

Closed
@Jxck

Description

@Jxck

https://github.com/openpeer/ortc/blob/master/ortc.html#L1036

this import is invalid. and also helper js invalid for export, even in ES6 modules.

but, in my opinion, helper is not good for Example.
each Example should complete itself for easy to understand.
and this helper seems not useful enough to add to Draft.

for example

function trace(text) {
  // This function is used for logging.
  text = text.trimRight();
  if (window.performance) {
    var now = (window.performance.now() / 1000).toFixed(3);
    console.log(now + ": " + text);
  } else {
    console.log(text);
  }
}

we don't always need to calculate performance time.
it's enough to use console.trace or console.log

function errorHandler(error) {
  trace("Error encountered: " + error.name);
}

enough to use console.error

function mySendLocalCandidate(candidate, component, kind, parameters) {
  // Set default values
  kind = kind || "all";
  component = component || RTCIceComponent.RTP;
  parameters = parameters || null;

  // Signal the local candidate
  mySignaller.mySendLocalCandidate({
    "candidate": candidate,
    "component": component,
    "kind": kind,
    "parameters": parameters
  });
}

this used in some line, but mySignaller.mySendLocalCandidate also called directory too.
this means call mySignaller.mySendLocalCandidate directory is enough, and helper is removable.

  • myIceGathererStateChange
  • myIceTransportStateChange
  • myDtlsTransportStateChange

only a message helper.
just use console.log and write a description of that event in draft(already done) is enough.

wrap up.
I think remove helper and write more understandable and complete in each section is better for draft Example.
if you agree with this, I can PR for Fix all Examples.

or if you think this helper is necessary, I think it OK but please fix import / export syntax with ES6 valid one.

thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions