-
Notifications
You must be signed in to change notification settings - Fork 17
Adds the new TypeScript SPS example #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
88f780d
removed all the old project files to make way for the example
adrianZahra d85c960
added tested example files from broken fork
adrianZahra 122793b
updated the library to output index.js instead of main.js
adrianZahra b0461c7
updated the example library name incase we add more examples
adrianZahra bab6390
removed the sps library dev dependency from the example devdependencies
adrianZahra 7f0d1d4
updated the npm build-all command and removed the redundant npm symli…
adrianZahra 29ebbf1
updated the description of the package to be inlie with the typescrip…
adrianZahra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| { | ||
| "name": "spstypescriptexample", | ||
| "version": "1.0.0", | ||
| "description": "The typescript example for consuming the Scalable Pixel Streaming Frontend", | ||
| "main": "index.ts", | ||
| "scripts": { | ||
| "build": "npx webpack", | ||
| "watch": "npx webpack --watch", | ||
| "start": "npx webpack && open-cli ./dist/index.html", | ||
| "serve": "webpack serve", | ||
| "build-all": "cd ../../library && npm install && npm run build && cd ../examples/typescript && npm install && npm link ../../library && npm run build" | ||
| }, | ||
| "author": "TensorWorks Pty Ltd", | ||
| "keywords": [], | ||
| "license": "MIT", | ||
| "devDependencies": { | ||
| "@types/node": "^18.15.1", | ||
| "@types/webpack": "^5.28.0", | ||
| "@webpack-cli/generators": "^3.0.1", | ||
| "clean-webpack-plugin": "^4.0.0", | ||
| "copy-webpack-plugin": "^11.0.0", | ||
| "css-loader": "^6.7.3", | ||
| "declaration-bundler-webpack-plugin": "^1.0.3", | ||
| "html-webpack-plugin": "^5.5.0", | ||
| "style-loader": "^3.3.1", | ||
| "ts-loader": "^9.4.2", | ||
| "html-loader": "^4.2.0", | ||
| "typescript": "^4.9.5", | ||
| "webpack": "^5.76.1", | ||
| "webpack-cli": "^5.0.1", | ||
| "webpack-dev-server": "^4.11.1", | ||
| "wepack-cli": "^0.0.1-security" | ||
| } | ||
| } |
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import * as spsFrontend from "@tensorworks/lib-spsfrontend"; | ||
|
|
||
| // Apply default styling from Epic's frontend | ||
| export const PixelStreamingApplicationStyles = new spsFrontend.PixelStreamingApplicationStyle(); | ||
| PixelStreamingApplicationStyles.applyStyleSheet(); | ||
|
|
||
| document.body.onload = function () { | ||
|
|
||
| // Create a config object. | ||
| // Note: This config is extremely important, SPS only supports the browser sending the offer. | ||
| const config = new spsFrontend.Config({ useUrlParams: true, initialSettings: { OfferToReceive: true, TimeoutIfIdle: true } }); | ||
|
|
||
| // Create a Native DOM delegate instance that implements the Delegate interface class | ||
| const stream = new spsFrontend.PixelStreaming(config); | ||
| const spsApplication = new spsFrontend.SPSApplication({ | ||
| stream, | ||
| onColorModeChanged: (isLightMode) => PixelStreamingApplicationStyles.setColorMode(isLightMode) /* Light/Dark mode support. */ | ||
| }); | ||
|
|
||
| document.body.appendChild(spsApplication.rootElement); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| const path = require('path'); | ||
| const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
| //const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
| const webpack = require('webpack'); | ||
|
|
||
| module.exports = (env) => { | ||
| return { | ||
| mode: "development", | ||
| entry: { | ||
| index: './src/index.ts', | ||
| }, | ||
| plugins: [ | ||
| new webpack.DefinePlugin({ | ||
| WEBSOCKET_URL: JSON.stringify((env.WEBSOCKET_URL !== undefined) ? env.WEBSOCKET_URL : '') | ||
| }), | ||
|
|
||
| new HtmlWebpackPlugin({ | ||
| title: 'Development', | ||
| template: './src/index.html', | ||
| filename: 'index.html' | ||
| }), | ||
| ], | ||
| // turn off so we can see the source map for dom delegate so we can debug the library | ||
| devtool: 'inline-source-map', | ||
| module: { | ||
| rules: [ | ||
| { | ||
| test: /\.tsx?$/, | ||
| loader: 'ts-loader', | ||
| exclude: [ | ||
| /node_modules/, | ||
| ], | ||
| }, | ||
| { | ||
| test: /\.html$/i, | ||
| use: 'html-loader' | ||
| }, | ||
| { | ||
| test: /\.css$/, | ||
| type: 'asset/resource', | ||
| generator: { | ||
| filename: '[name][ext]' | ||
| } | ||
| }, | ||
| { | ||
| test: /\.(png|svg)$/i, | ||
| type: 'asset/resource', | ||
| generator: { | ||
| filename: 'images/[name][ext]' | ||
| } | ||
| }, | ||
| ], | ||
| }, | ||
| resolve: { | ||
| extensions: ['.tsx', '.ts', '.js', '.svg'], | ||
| }, | ||
| output: { | ||
| filename: '[name].js', | ||
| library: 'spstypescriptexample', | ||
| libraryTarget: 'umd', | ||
| path: path.resolve(__dirname, 'dist'), | ||
| clean: true, | ||
| globalObject: 'this' | ||
| }, | ||
| experiments: { | ||
| futureDefaults: true | ||
| }, | ||
| optimization: { | ||
| minimize: false | ||
| }, | ||
| devServer: { | ||
| static: { | ||
| directory: path.join(__dirname, 'dist'), | ||
| }, | ||
| }, | ||
| }; | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.