Git Product home page Git Product logo

js-examples's Introduction

js-examples

This repository contains examples of JavaScript usage.

The "promises-test" directory contains a JS promises test example, for learning purposes. Run the example live.

The "modules" directory contains a series of examples that explain how JavaScript modules are used. The subdirectories are as follows:

js-examples's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-examples's Issues

CODE_OF_CONDUCT.md file missing

As of January 1 2019, Mozilla requires that all GitHub projects include this CODE_OF_CONDUCT.md file in the project root. The file has two parts:

  1. Required Text - All text under the headings Community Participation Guidelines and How to Report, are required, and should not be altered.
  2. Optional Text - The Project Specific Etiquette heading provides a space to speak more specifically about ways people can work effectively and inclusively together. Some examples of those can be found on the Firefox Debugger project, and Common Voice. (The optional part is commented out in the raw template file, and will not be visible until you modify and uncomment that part.)

If you have any questions about this file, or Code of Conduct policies and procedures, please see Mozilla-GitHub-Standards or email [email protected].

(Message COC001)

Top Level Await examples do not have await code

under the top level await example folder, the code in main.js file is similar to dynamic module imports example folder main.js file content,

There is no example of usage of await syntax.

Cheke this file

https://github.com/mdn/js-examples/blob/main/module-examples%2Ftop-level-await%2Fmain.js

this code is similar to the previous example (dynamic module import) file

https://github.com/mdn/js-examples/blob/main/module-examples%2Fdynamic-module-imports%2Fmain.js

import syntax error

My development environment is:

Microsoft Windows 7 Professional SP 1
Microsoft Visual Studio 2008 Professional SP1
Microsoft Visual C# 2008
Firefox 69.0.2 (64-bit)

I have copied all of your files from GitHub in the directory

mdn/js-examples/modules/basic-modules

into a directory with the following structure:

index.html
main.mjs
modules/
    canvas.mjs
    square.mjs

When I run JSLint against index.html I get the following message

Developed by Matthias Miller (http://www.JavaScriptLint.com)

index.html
main.mjs
C:\Gustafson\Projects\JavaScriptModules\main.mjs(1): SyntaxError: missing name in import statement
import { create, createReportList } from './modules/canvas.mjs';
.......^


1 error(s), 0 warning(s)

As a result, index.html does not display.

Please advise what I am doing wrong. Thanks

.mjs modules

Hey,

I took the freedom to change the page about js modules. Mostly because when putting the .js extension gives me the following errors:

Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec. - Chromium
Loading module from “http://127.0.0.1:8001/utils.js” was blocked because of a disallowed MIME type (“text/plain”). Loading failed for the module with source “http://127.0.0.1:8001/utils.js”. - Firefox

Renaming them to .mjs fixes it.

The reason as to why I changed it was that the docs were the first page I looked at. I tried the examples on the page to no avail just to be met by errors and had to search a while to make it work.

Would you be so kind to rename the modules from name.js to name.mjs to make the changes consistent? (When somebody decides to clone the examples)
Also, if my change wasn't a correct one, please let me know.

Best regards!

The module example fails due to CORS

I tried modules/basic-modules/
Nothing displayed in the browser. In F12 console, I see
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///E:/js%20examples%20from%20mdn/js-examples-master/modules/basic-modules/main.js. (Reason: CORS request not http).
2
Module source URI is not allowed in this document: “file:///E:/js%20examples%20from%20mdn/js-examples-master/modules/basic-modules/main.js”.

Web Modules don't appear to be working on MacOS Firefox

System info

Desktop
MacOS Catalina Version 10.15.4
FireFox 57.04

Mobile
iPhone 11 Pro v13.31
Firefox Version 24.1 (17574)

So the behavior I'm seeing is that on the Mobile version of the App, the example in "basic-modules" linked to from the ReadMe (https://mdn.github.io/js-examples/modules/basic-modules/) shows up on Mobile but does not show up on the Mac version

It looks like it's making the request but just not doing anything once it gets the file? I'm not sure, I attached some screenshots.

Screenshot 2020-04-12 at 9 02 01 PM

Screen Shot 2020-04-12 at 9 02 51 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.